springboot配置热部署具体步骤
时间: 2023-10-14 18:31:11 浏览: 102
下面是 Spring Boot 配置热部署的步骤:
1. 在 pom.xml 文件中添加 devtools 依赖:
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
```
2. 在 application.properties 文件中添加如下配置:
```
# 开启热更新
spring.devtools.restart.enabled=true
# 热更新的目录,多个目录用逗号隔开
spring.devtools.restart.additional-paths=src/main/java,src/main/resources
# 热更新的文件类型
spring.devtools.restart.additional-file-patterns=*.xml,*.properties,*.yml
```
3. 在 IDEA 中配置自动编译:
点击 File -> Settings -> Build, Execution, Deployment -> Compiler,将 Build project automatically 勾选上。
4. 启动项目:
点击 Run -> Edit Configurations,在 VM options 中添加如下配置:
```
-javaagent:/path/to/spring-boot-devtools.jar
```
其中 `/path/to/spring-boot-devtools.jar` 是 spring-boot-devtools 的 jar 包路径。
5. 修改代码并保存:
修改代码后,保存即可进行热部署。
阅读全文
相关推荐
















