我有一个 Spring Boot 应用程序在 Intellij IDE 上运行良好。即我启动了具有委托给 SpringApplication.run 的 main 方法的 Application 类。除了热插拔之外,一切都很好。当我更改源时,我被迫重新启动应用程序。即使我在调试模式下启动应用程序,我也看不到热插拔工作。我可以看到 Intellij 的调试设置已启用热插拔。
我的观察表明,当我运行 spring boot 应用程序时,使用的类路径是我的
/projects/MyProject/classes/production/....
文件下classes/production
当我更改代码时没有得到更新。 Intellij IDE 编译文件但不更新类/生产目录。如何让热插拔与适用于 spring-boot 的 IntelliJ IDE 一起使用?
使用 devTools 的解决方案有效:
1 - 将开发工具添加到您的项目中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
2 - 启用自动构建
Open 设置 --> 构建-执行-部署 --> 编译器并启用:
Build Project Automatically.
3 - 更新compiler.automake.allow.when.app.running的值
press ctrl+shift+A
并搜索registry
。在注册表中,启用:
compiler.automake.allow.when.app.running
参考 :
- https://dzone.com/articles/spring-boot-application-live-reload-hot-swap-with
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)