보라코딩

Spring Boot Devtools 적용하기 본문

코딩/Spring

Spring Boot Devtools 적용하기

new 보라 2023. 7. 17. 19:33
Spring Boot Devtools 대표기능

 

-  Automatic Restart : classpath에 있는 파일 변경시마다 애플리케이션 자동 재시작

- Live Reload : html, css, js 수정시 새로고침 없이 바로 적용

- Property Defaults : 타임리프 성능 향상시키기 위해 캐싱 기능 사용하나

                              개발 과정에서 수정한 소스 제대로 반영되지 않을 수 있어 false로 설정 가능

 

 

 

 

pom.xml
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
</dependency>

 

 

 

Automatic Restart 적용

 

 

shift 두번 클릭한 후 검색

 

 

 

 

 

소스 수정시 자동 빌드 되도록 설정

 

 

File - Settings - build,execution,deployment - compiler

 

Build project automatically 선택 후 OK

 

 

 

 

Live Reload 적용하기

 

 

application.properties

#Live Reload
spring.devtools.livereload.enabled=true

 

 

 

구글 크롬 웹 스토어에서 LiveReload 검색해서 설치

 

 

 

모든사이트에서 적용가능하도록 옵션 선택

초록색으로 나오면 활성화된 상태

 

 

 

 

 

Property Defaults 적용

 

#Thymeleaf cache stop
spring.thymeleaf.cache=false