IDEA2024.3版本热部署设置步骤

IDEA2024.3版本热部署设置步骤

1. 添加 Spring Boot DevTools 依赖

pom.xml 中引入热部署工具包,这是实现热部署的核心依赖:

<dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-devtoolsartifactId>
    <optional>trueoptional>
dependency>

该依赖会监控类路径下的文件变动并自动重启应用。

application.properties 中设置DevTools依赖热部署路径:

spring.devtools.restart.enabled=true
spring.devtools.restart.additional-paths=src/main/java
2. 启用自动编译功能
  • 路径File > Settings > Build, Execution, Deployment > Compiler
  • 操作:勾选 Build project automatically(确保代码修改后自动触发编译)
3. 高级设置
  • 打开 IDEA,通过快捷键 Ctrl+Alt+S(Windows/Linux)或 Cmd+,(Mac)进入 Settings(设置)。

  • 在设置界面左下角找到 Advanced Settings(高级设置),点击展开。

  • 在高级设置中,通过搜索框输入 allowauto-make,快速定位到以下选项:

    • Allow auto-make to restart even if developed application is currently running
      (允许在应用运行时自动编译重启)
  • 勾选此选项即可启用热部署功能。

4. 修改注册表配置
  • 快捷键:按下 Ctrl+Shift+A,搜索输入 Registry 并打开。
  • 参数
    • (可选)若需加快触发速度,调整 compiler.automake.trigger.delay(默认 300ms)和 compiler.automake.postpone.when.idle.less.than(默认 3000ms)为更小值,比如100ms。

你可能感兴趣的:(idea)