方法一:devtools
Pom.xml中直接添加依賴即可:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>provided</scope>
<!--optional我沒弄明白憨栽,都說必須為true,但我測試true,false屑柔,不加都可以-->
<optional>true</optional>
</dependency>
通過項(xiàng)目主程序入口啟動(dòng)即可屡萤,改動(dòng)以后重新編譯就好。
方法二:springloaded
Pom.xml中直接在spring-boot插件中添加依賴即可:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<!-- spring熱部署 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
</dependencies>
<configuration>
<mainClass>cn.springboot.Mainspringboot</mainClass>
</configuration>
</plugin>