쉬운 프로그래밍

[Spring Boot] 인텔리제이 Live Reload 설정 본문

Programming/Spring Boot

[Spring Boot] 인텔리제이 Live Reload 설정

쉬운형 2021. 2. 7. 12:12

템플릿엔진이나, js css등 수정이 잦은 것들을 매번 새로 빌드 하는 것은 매로 번거로운 일이다.

 

SpringBoot Devtools를 통해 새로고침 만으로 resources 밑의 파일들의 실시간 반영을 할 수 있다.

1. Gradle

compile "org.springframework.boot:spring-boot-devtools"

Maven은 귀찮아서..

 

 

2. application.properties

spring.devtools.livereload.enabled=true

 

3. 인텔리제이 설정

 

인텔리제이 같은 경우에는 설정을 따로 해줘야 devtools livereload가 적용된다.

 

먼저, ctrl + shift + a 를 누른 후 Registry를 검색한다.

 

 

다음으로 아래 옵션을 체크해준다.

 

 

마지막으로 setting - build - compiler에서 Build project automatically를 체크한다.

 

 

4. Live ReLoad 플러그인 설치

 

본인이 크롬, 사파리, 파폭 등 뭐를 쓰더라도 Live ReLoad 플러그인을 설치해야 한다.

 

크롬 Live Reload 플러그인 : chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei

 

LiveReload

Provides Chrome browser integration for the official LiveReload apps (Mac & Windows) and third-parties like guard-livereload and…

chrome.google.com

설치한 후 플러그인을 실행하면 정상적으로 LiveReload를 사용할 수 있을 것이다.

 

 

나는 이렇게 다했는데 안돼서 한시간 넘게 삽질하다가 always-develop.tistory.com/53 를 보고 해결했다.

 

applications.properties에 다음과 같은 코드를 추가한다..

 

css/js/img

spring.resources.static-locations=file:src/main/resources/static/

 

thymeleaf

spring.thymeleaf.cache=false
spring.thymeleaf.prefix=file:src/main/resources/templates/

 

그리고 라이브 로드 관련 설정들은 배포시 꼭 지워줘야한다~! 안그럼 서버 터짐..

'Programming > Spring Boot' 카테고리의 다른 글

[Spring Boot] ResponseEntity와 TestRestTemplate  (0) 2021.02.17
[Spring Boot] Spring Security Security Config  (0) 2021.02.02
[Lombok] @RequiredArgsConstructor  (0) 2021.02.01
[Spring Boot] OAuth 2.0 기본 세팅  (2) 2021.01.29
REST API  (0) 2021.01.26
Comments