Spring Boot 자동 reload

유진·2022년 7월 23일

SpringBoot

목록 보기
1/1
post-thumbnail

소스 변경할 때마다 서버 재시작해서 확인하는 게 번거로울 때

1. spring-boot-devtools 의존성 추가하기

  • gradle

build.gradle 에서

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
}

configurations {
	developmentOnly
	runtimeClasspath {
		extendsFrom developmentOnly
	}
}
  • maven

pom.xml 에서

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

2. Automatic Restart 적용하기

IntelliJ Setting

File -> Setting -> Complier
Build project automatically 체크

File -> Setting -> Advanced Settings -> Compiler
Allow auto-make to start even if developed application is currently running 체크

3. thymeleaf cache 사용 중지

cache 사용을 중지해야만 소스코드 수정 이후 적용이 된다.

application.properties 에서

spring.thymeleaf.cache=false
profile
웹 벡엔드 개발자 지망생입니다

0개의 댓글