<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.5.RELEASE</version> </dependency> </dependencies> </plugin> </plugins> </build>
注意1:若是发现没有热部署效果,则须要检查idea配置中有没有打开自动编译:html
注意2:若是使用Thymeleaf模板引擎,须要把模板默认缓存设置为falsejava
#禁止thymeleaf缓存(建议:开发环境设置为false,生成环境设置为true) spring.thymeleaf.cache=false
<!-- 热部署模块 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <!-- 这个须要为 true 热部署才有效 --> </dependency>