IntelliJ 에서의 devtools 를 사용하기 위한 기본적인 내용을 다룸.
1) spring-boot-devtools
해당 의존은 패키지의 소스 변경이 발생할 경우 자동으로 빌드를 진행하고 결과를 바로 확인 할 수 있거나,
리소스의 변경이 이루어질 경우 새로 고침을 하는 등 Spring Boot 개발을 진행 할때 편리한
도구가 포함된 라이브러리 입니다.
2) 참조 추가
# Maven
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
# Gradle
dependencies {
compileOnly("org.springframework.boot:spring-boot-devtools")
}
3) properties 설정
* 옵션 내용 설명
# Auto restart
spring.devtools.restart.enabled
# Auto restart 제외 경로
spring.devtools.restart.additional-exclude
# dev-tools auto restart
spring.devtools.restart.enabled=true
spring.devtools.restart.additional-exclude=static/**,public/**
4) IntelliJ 환경 설정
STS와 다르게 IntelliJ에선 사전 설정 옵션이 필요함.
STS와 다르게 IntelliJ에선 사전 설정 옵션이 필요함.
ctrl + alt + s 단축키로 환경 설정 진입
build, Execution, Deployment -> Compiler -> Build project auto...
체크 활성화
설정 진입
Adbanced Settings -> Compiler -> Allow auto-make to start even if...
체크 활성화
5) 확인
스프링 부트 실행 이후 소스 변경 (수정후 저장) 이 발생할 경우
console 화면에서 서버 재기동 되는 모습 확인.