项目采用的Springboot2.x,开发工具是Eclipse

1.使用springloaded热部署模式1.1 pom.xml配置

<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><dependencies><!-- spring热部署 --><dependency><groupId>org.springframework</groupId><artifactId>springloaded</artifactId><version>1.2.8.RELEASE</version></dependency></dependencies></plugin></plugins></build>

1.2 设置Run configurations

选中项目,鼠标右键点击,选择Debug As 或者 Run As 下面的 Debug Configurations...

找到 Java Application ,双击,选择Arguments,在VM arguments 下面添加以下内容,点击Apply-->Close即可

// 中间部分是springloaded的本地jar包路径,根据实际情况修改即可-javaagent:E:\Program Files\maven-repository\org\springframework\springloaded\1.2.8.RELEASE -noverify

1.3 双击Tomcat打开配置文件,关闭自动发布,保存

重新发布项目,启动Tomcat,即可

2.使用Eclipse自带热部署模式(简单明了)

功能稍弱,仅支持已有类的热部署,新增方法需要重新启动

2.1 双击Tomcat打开配置文件,关闭自动发布,保存