eclipse –> Project –> Build Automatically 要选中,不选中的话不起作用。
———————
新建spring boot starter后,
右键 project— add dev tool
在 pom.xml会自动加上:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
pom.xml加上:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
上面是有的,只加下面代码:
<configuration>
<fork>true</fork><!– 如果没有该项配置,devtools不会起作用,即应用不会restart –>
</configuration>
———
application:
spring.devtools.restart.additional-paths:src/main/resources
server.port=8059
热部署后,改端口,就不用重启了。 mvn spring-boot:run