IntelliJ IDEA 2021.3 Ultimate Edition, Mac 기준입니다

코드나 리소스가 변경됐을 때 서버를 수동으로 재시작 시키는게 매우 번거로웠는데, 아래 과정을 따라하면 이제 코드에만 집중할 수 있습니다.

 

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools
implementation 'org.springframework.boot:spring-boot-devtools:2.6.2'

1. build.gradle(또는 pom.xml)에 spring-boot-devtools 의존성 추가

spring.devtools.livereload.enabled는 기본적으로 true로 설정됩니다.

 

spring.mustache.cache=false

2. application.properties에서 템플릿 엔진의 cache false로 설정

각자 사용하는 템플릿엔진에 맞게 바꿔줍니다 (ex. thymeleaf, mustache, handlebars, ...)

⚠️ 주의: dev 환경에서만 사용해야 합니다 !

 

3. "Preferences - Build, Execution, Deployment - Compiler"에서 "Build project automatically" 체크

 

4. "Preferences - Advanced Settings"에서 Compiler - "Allow auto-make to start even if deployed application is currently running" 체크

(이전 버전까지는 registry - "compiler.automake.allow.when.app.running"을 수정해야 했습니다)

 

5. 브라우저에서 새로고침할 때 캐시 지우고 새로 고치기 (크롬이면 cmd + shift + R)

반응형