티스토리 뷰

ETC

[ETC/Intelij] Spring autoReload 사용하기 (gradle)

주인장 진빼이

매번 소스코드를 수정하고나서 재시작 버튼을 누르는 것에 대한 비용은 스택이 쌓일 수록 무시하지 못한다.

그러므로 소스코드를 저장할 때마다 자동으로 서버를 재시작하는 옵션을 사용하자.

 

intelij 2022.1.2를 기반으로 작성되었다.

 

1. 디펜던시 추가 및 devtools 설치

build.gradle에서 다음 내용을 dependencies 영역에 삽입한다.

오른쪽 상단에 리프래시(refresh) 버튼을 누르는 것을 잊지말자

developmentOnly 'org.springframework.boot:spring-boot-devtools'

 

2.  application.properties 수정

아래 한줄을 추가하도록 하자

spring.devtools.livereload.enabled=true

 

3. Intelj 설정 -> Build project automatically 체크

 

 

4. Intelj설정 -> Advanced Settings->Compiler

Allow auto-make to start even if developed application is currently running 체크

 

5. 크롬 확장프로그램 설치

https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=ko 

 

LiveReload

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

chrome.google.com

 

이제 소스코드 저장 시 스프링부트에 실행되고 있는 톰캣 서버가 재시작되는 것을 확인할 수 있다.

 

 

댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함