IntelliJ Spring 부트 서버 재실행 없이 실시간 반영하기
개발 환경
IntelliJ + spring boot + gradle
혹은
IntelliJ + spring boot + maven
build.gradle
dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
}
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
Registry 변경
shift를 두번 눌러 검색창을 띄운 후 registry설정에 들어간다.
compiler.automake.allow.when.app.running을 체크하면 된다.
registry
application.properties 설정 추가
resources 폴더 안에 있는 application.properties에 아래 두줄을 추가해준다.
spring.devtools.livereload.enabled=true
spring.freemarker.cache=false
Compiler 설정
ctrl+alt+s를 눌러 설정에 들어간후 compiler를 검색한다.
Build project automatically를 체크하면 된다.
구글링을 하면 보통 여기까지만 설명이 되어있다. 나는 이렇게 해도 동작하지않아 아래의 방법까지 하고 나서야 코드 실시간 반영이 되었다.
Run/Debug Configurations 설정
상단바에서 Run -> Edit Configurations
On update action과 On frame deactivation을 Update classes and resources로 변경한다.
마지막으로 서버 재시작을 하면 된다.
[IntelliJ] 서버 재시작 없이 코드 실시간 반영하기
구글에 흔히 나와있는 방법으로 동작하지않아 서치하며 얻은 결과를 종합해 정리해보겠다.개발 환경IntelliJ + spring boot + gradle먼저 gradle에 Spring Boot DevTools을 추가한다shift를 두번 눌러 검색창을
velog.io