1.添加架包
<!--支持热启动jar包--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <version>${spring-boot.version}</version> <optional>true</optional> <!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖该项目的项目如果想要使用devtools,需要重新引入 --> </dependency> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> <dependencies> <!-- spring热部署--> <!-- https://mvnrepository.com/artifact/org.springframework/springloaded --> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency> </dependencies>2.devtools的配置</plugin>
spring.devtools.restart.enabled: true
#设置重启的目录
#spring.devtools.restart.additional-paths: src/main/java
#classpath目录下的WEB-INF文件夹内容修改不重启
spring.devtools.restart.exclude: WEB-INF/**
3.IDEA配置 File-Settings-Compiler-Build Project automatically
选中 Make Project authomatically
ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
SpringBoot学习:使用spring-boot-devtools进行热部署
最新推荐文章于 2024-01-12 09:47:35 发布