카테고리 없음
intellij에서 static resource(html, js 등) 바로 반영되게 하는 방법
광82
2023. 7. 16. 10:12
반응형
Spring boot에서 resources 디렉토리를 수정한 후 그것을 확인하기 위해서는 WAS(Tomcat 등)를 재시작 해야 합니다.
수정 할 때마다 재시작 하는 것은 매우 귀찮은 일입니다.
설정 방법
Intellij에서 바로 반영되게 하는 방법은 다음과 같습니다.
1. build.gradle에 의존성 추가
dependencies {
...
compile('org.springframework.boot:spring-boot-devtools')
}
2. application 설정파일 수정(yml / properties)
- 다음은 application.yml의 thymeleaf 사용 예시입니다.
spring:
devtools:
livereload:
enabled: true
thymeleaf:
cache: false
3. Run/Debug Configurations 수정
- Run > Edit Configurations 메뉴로 이동
- Spring Boot > xxxApplication 선택
- On 'Update' action과 On frame deactivation을 Update classes and resources로 변경
Run/Debug Configurations
4. registry 설정
- Ctrl + Shift + A 버튼을 눌러서 Actions 검색창을 Open
- registry 검색
- compiler.automake.allow.when.app.running 항목 체크
반응형