spring boot在Eclipse中,修改代码后无需重启就生效的配置

来源:互联网 发布:微信淘宝客自动发单 编辑:程序博客网 时间:2024/06/07 06:21

在Eclipse中启动spring boot项目后,如果修改了代码,缺省是需要重启项目才能生效。如果想不重启也生效,可以这样配置:

只需要在pom.xml文件中,加入下面的<dependencies>标签部分,就可以实现修改代码后无需重启就生效。


[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <build>  
  2.     <finalName>my-spring-boot</finalName> <!-- 指定package生成的文件名为my-spring-boot.jar -->  
  3.       
  4.     <plugins>  
  5.         <plugin>  
  6.             <groupId>org.springframework.boot</groupId>  
  7.             <artifactId>spring-boot-maven-plugin</artifactId>  
  8.             <dependencies>    <!-- 修改代码后自动生效,Reload Java classes without restarting the container -->  
  9.                 <dependency>  
  10.                     <groupId>org.springframework</groupId>  
  11.                     <artifactId>springloaded</artifactId>  
  12.                     <version>1.2.6.RELEASE</version>  
  13.                 </dependency>  
  14.             </dependencies>  
  15.         </plugin>  
  16.     </plugins>  
  17. </build>  
0 0