
implementation 'org.springframework.boot:spring-boot-devtools'
// developmentOnly 'org.springframework.boot:spring-boot-devtools'
build.gradle에 devtools 추가하기 - 둘 중 어느것을 추가해도 된다.
(Gradle 사용)

File - settings - Advanced Settings - Compiler
Allow auto-make to start even if developed application is currently running 체크하기

Settings - Build, Execution, Deployment - Compiler
Build project automatically 체크

옵션수정 클릭

Modify options 클릭

On 'Update' action - Update classes and resources 클릭

On frame deactivation - Update classes and resources 체크

구성창이 다음과 같이 바뀐거 확인

application.properties 파일에 다음을 추가
2022-12-29 수정: 이거 안해도 잘 돌아가는 듯 합니다.
+) gradle refresh

IntelliJ에서 리로드 버튼을 누르거나
터미널로 해당 프로젝트 위치로 이동하여 다음과 같은 명령어를 친다.
gradlew -- refresh-dependencies
+) restarted main이라고 안떠도 devtools는 동작한다.

참고
1) Gradle Dependency refresh 방법 (velog.io)
Gradle Dependency refresh 방법
여러개의 Dependency를 추가하고 간혹 꼬이는 경우가 발생한다.Visual Studio Code, Intelli J 등 IDE에서 제공하는 기능을 사용할 수도 있지만, 개발하는 개발자 마다 IDE가 다를 수 있어 명령어로 처리하는
velog.io
2) spring-boot-devtools 적용 및 사용 (tistory.com)
spring-boot-devtools 적용 및 사용
Devtools html 파일을 컴파일만 해주면 서버 재시작 없이 View 파일 변경이 가능하다. Devtools 기능 - Property Defaults Spring에서 제공하는 thymeleaf는 캐싱 기능을 사용한다. 캐싱이 되면 파일을 수정하더라.
devmango.tistory.com
3) [Web] spring-boot-devtools 라이브러리 사용 방법 (tistory.com)
[Web] spring-boot-devtools 라이브러리 사용 방법
* 이 글은 MacOS, intelliJ, Gradle을 기반으로 합니다. devtools 라이브러리에서 제공하는 기능은 다음과 같다. Property Defaults Automatic Restart Live Reload Global Settings Remote Applications 여기서..
seolhee2750.tistory.com
'Backend > Spring' 카테고리의 다른 글
| SDK 17 is not compatible with the source version 17 (4) | 2023.01.09 |
|---|---|
| maven이란? (1) | 2023.01.09 |
| Spring Framework란? (2) | 2022.12.28 |
| springboot H2 데이터베이스 사용 에러: Failed to load ApplicationContext (2) | 2022.10.02 |
| intelliJ Cause: error: invalid source release: 17 해결 (2) | 2022.10.01 |