springboot(6)-热部署

使用springboot结合dev-tool工具

1.添加依赖

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>

2如图,在设置中打开即可。

按快捷键 Shift+Ctrl+Alt+/ ,打开maintenance面板, 选择 Registry

3配置

  • 不被热部署的文件
/META-INF/maven, /META-INF/resources, /resources, /static, /public, or /templates
  • 指定文件不进行热部署
spring.devtools.restart.exclude=static/,public/
  • 手工触发重启
spring.devtools.restart.trigger-file=trigger.txt

改代码不重启,通过一个文本去控制

4注意点

生产环境不要开启这个功能,如果用java -jar启动,springBoot是不会进行热部署的

原文地址:https://www.cnblogs.com/xeclass/p/12634607.html