Backend/Springboot

Spring-boot-devtools 적용

박 성 하 2023. 8. 25. 22:16
728x90

Spring-boot-devtools

Spring Boot 프레임워크에서 제공하는 모듈 또는 기능으로, 개발 주기를 단축하고 더 편리하게 만드는 도구

 

devtools 기능

1. Automatic Restart

- 소스 코드에서 변경 사항이 감지될 때마다 애플리케이션을 자동으로 다시 시작하는 기능

- 수동으로 재시작할 필요가 없으므로 개발 시간을 절약할 수 있음

 

2. Live Reload

- 정적 리소스가 변경될 때마다 브라우저 새로고침 또는 페이지 재로드를 감지

- 페이지를 수동으로 새로고침하지 않고도 브라우저에서 즉각적인 업데이트 가능

 

3. Remote Development

- 원격 애플리케이션 인스턴스에 연결하여 자동 재시작 및 실시간 재로드 기능을 활용할 수 있음

 

4. Property Defaults

- 배포할 때 재정의할 수 있는 합리적인 속성 기본값을 제공

- 애플리케이션 속성을 쉽게 관리할 수 있음

 

5. Console Logging

- 로깅 출력을 읽기 쉽고 다채로운 형식으로 구성

- 로그 메시지를 빠르게 식별하는 데 도움이 됨

 

6. Disable Caching

- 캐싱으로 인해 변경 사항의 가시성이 저하될 수 있기 때문에 특정 유형의 캐싱을 비활성화하여 변경 사항이 즉시 반영될 수 있도록 함

 

적용 방법

1. 의존성 추가

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools
implementation group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '3.1.2'

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

 

2. Preferences(Settings) -> build, Execution, Deployment -> Compiler -> Build project automatically 체크

3. Advanced Settings -> Allow auto-make to start even if developed application is currently running 체크

4. 우측 상단 Select Run/Debug Configuration -> Edit Configurations -> On 'Update' action & On frame deactivation 정책을 Update classes and resources로 설정

5. application.properties 수정

spring.devtools.restart.enabled=true
spring.thymeleaf.cache=false //thymeleaf 사용 시

 

728x90