我们IEDA开发SpringBoot程序时,只要Controller修改了就要重启程序,Web界面的东西才会刷新,其实SpringBoot提供了动态修改的方法,修改完后不需要重启程序,界面会自动刷新!
第一步:Pom添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
第二步:

第三步:键盘同时按住四个键 ctrl+shift+alt+/ 然后选择Registry,勾选

测试:
1、启动程序,目前只有一个Mapping

2、不停止程序,新增一个
@RequestMapping("/spark")
public String spark() {
return "Hello spark";
}
然后Web直接访问http://localhost:8080/spark

网友评论