sum*_*n j 54 intellij-idea hotswap spring-boot
我有一个使用Intellij IDE运行良好的Spring启动应用程序.即我启动了具有委托给SpringApplication.run的main方法的Application类.除了hotswap,一切都很好.当我更改源代码时,我被迫重新启动应用程序.即使我在调试模式下启动应用程序,我也看不到hotswap工作.我可以看到Intellij的Debug设置启用了hotswap.
我的观察表明,当我运行springboot应用程序时,使用的类路径是我的
/projects/MyProject/classes/production/....
classes/production更改代码时,下面的文件没有更新.Intellij IDE编译文件但不更新classes/production目录.如何使用IntelliJ IDE进行spring-boot热插拔?
Rad*_*FID 87
使用devTools的解决方案有效:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
打开设置 - >构建 - 执行 - 部署 - >编译器并启用:
Build Project Automatically.
Run Code Online (Sandbox Code Playgroud)
按下ctrl+shift+A并搜索registry.在注册表中,启用:
compiler.automake.allow.when.app.running
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你 !
参考文献:
sum*_*n j 22
找出根本原因.这与Spring-boot无关.在更改我的常规源文件时,文件未自动编译.
要重新编译已更改的文件并进行交换:
Ctrl+Shift+F9 在Windows上Cmd+Shift+F9 在Mac上小智 10
就我而言,即使在添加 Spring Boot 开发工具并自动检查构建项目后,它也无法正常工作。缺少的是这个:
转到项目运行配置。
将“更新”操作和“帧停用”都设置为“更新类和资源”。它就像一个魅力。
she*_*hub 10
步骤1:添加开发人员工具
Maven。
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
摇篮。
dependencies {
compile("org.springframework.boot:spring-boot-devtools")
}
Run Code Online (Sandbox Code Playgroud)
第2步:转到文件| 设置| 构建,执行,部署| 编译器
自动启用构建项目并应用并确定
步骤3:按快捷键Ctrl + Shift + A和搜索注册表关键字,然后按Enter
启用complier.automake.allow.when.app.running并单击“ 关闭”按钮
步骤4:在您喜欢的网络浏览器上禁用缓存
步骤5:完成!!!
小智 5
我也注意到了同样的问题。我在 Intellij 13.1.1 上。并让它热交换改变的类。我必须在调试模式下运行应用程序,然后在更改类后,手动选择“运行->重新加载已更改的类”。
我也将调试器设置为热交换,如http://www.jetbrains.com/idea/webhelp/reloading-classes.html所示,但似乎不起作用。
无论如何,至少手动“运行->重新加载更改的类”菜单有效。
@Sameer Khanal 的回答有效,但由于已经过去了很长时间,我提供一些澄清
安装 spring boot devtools 依赖项(https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools)
单击“确定”即可完成
希望有帮助
| 归档时间: |
|
| 查看次数: |
39538 次 |
| 最近记录: |