프로그래밍/Java

[인텔리제이 2020.3] 스프링 부트 + Java + thymeleaf 수정시 자동 리로드(새로고침) 방법 (최종)

소행성왕자 2023. 8. 21. 12:56

Java 파일과 thymeleaf 템플릿 html 파일수정시 새로고침 없이 자동으로 리로드 되는 방법을 소개합니다.

 

  • mac : cmd + shift +a 
  • window : ctrl + shift +a

registry 검색 후 compiler.automake.allow.when.app.running 체크

setting > Build, Execution, Depoyment >Compiler 

Build project automatically 체크

resources > application.yml

server:
  port: 8080

spring:
  datasource:
    driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
    url: jdbc:log4jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul
    username: username
    password: password

  thymeleaf:
    cache: false
    prefix: file:src/main/resources/templates/
    suffix: .html
  devtools:
    restart:
      enabled: true



mybatis:
  mapper-locations: classpath:mapper/**.xml


# log4jdbc, Mybatis Console Log
logging:
  level:
    com:
      zaxxer:
        hikari: INFO
    javax:
      sql:
        DataSource: OFF
    jdbc:
      audit: OFF
      resultset: OFF
      resultsettable: INFO  #SQL 결과 데이터 Table을 로그로 남긴다.
      sqlonly: OFF     #SQL만 로그로 남긴다.
      sqltiming: INFO    #SQL과 소요시간을 표기한다.
      connection : OFF  # 커넥션 확인가능
    org:
      hibernate:
        SQL: DEBUG
        type:
          descriptor:
            sql:
              BasicBinder: TRACE