[英]javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated after upgrading Spring Boot from 2.1.0 to 2.2.0.M3
[英]Spring boot auto reload stopped after upgrading from 2.1.13 to 2.2.0
以下是我的 POM 的相关部分
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.13.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>runtime</scope>
</dependency>
</dependencies>
如您所见,我已经安装了 devtools。 它适用于2.1.13.RELEASE
版本。 当我在 Java class 中进行更改并在 Intellij IDEA 中点击 Build Project 时,服务器将按预期重新启动并使用新的更改。
但是当我将 spring 引导版本升级到2.2.0.RELEASE
或2.2.5.RELEASE
时,自动重启停止工作。 当我进行更改并构建项目时,什么也没有发生。 我检查了文档,根据该文档,添加 devtools 依赖项就足够了。
更新 1 :我创建了一个演示应用程序供任何人尝试,看看它是否适合他们。 这是存储库。 尝试使用mvn spring-boot:run
运行它并在运行时编辑BookApi.java
,重建它应该触发实时重启。
更新 2 :这是我在启动应用程序时得到的日志: https://gist.github.com/lokeshh/d111c1429323ddf6e4a8d020526ceccb
更新 3 :我尝试 STS 4 来测试问题是否出在我的 IntelliJ 上。 我发现在 STS 4 中也存在同样的问题。自动重新加载在保存时适用于 2.1.13,但不适用于 2.2.0。
更新 4 :删除了完整的.m2
存储库,仍然是同样的问题。 以下是启用了 devtools 跟踪的日志https://gist.github.com/lokeshh/d111c1429323ddf6e4a8d020526ceccb#file-output_with_trace-log
好吧,它对我也很有效,就像其他为您回答的人一样。
但我在这里为您提供解决方案。 它可能会在某个时候发生。 执行下面提到的步骤。
由于您已经在pom.xml
添加了依赖项,所以让我们进入下一步。
下一个
确认intellij 中的设置。 .
=>自动构建项目
File –> Setting –> Build, Execution, Deployment –> Compiler –> check this Build project automatically
然后,检查Intellij 注册表
按SHIFT+CTRL+A
(Win/*nix) 或Command+SHIFT+A
(Mac) 打开一个弹出窗口,输入registry
找到并启用这个选项compiler.automake.allow.when.app.running
完成。 现在,应该启用热插拔和静态文件自动重新加载。
如果未重新加载静态文件,请按CTRL+F9
强制重新加载。
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools-restart
对于这两个版本,自动重启适用于我的设置中的代码。 虽然我使用的是 STS-4-4.6.0 版本。
但是我注意到一件事,它给出了无法刷新实时数据警告,所以我在 pom.xml 中添加了下面的代码,并且警告也被删除了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
注意:无论是否在 STS 中,它都对我有用,但是您仍然可以在 Intellij 中尝试此操作,可能是这导致了一些问题,因为 LiveReloadServer 是 devtools 实际用于自动加载的
当 liveReloadServer 启动时,这会打印在日志中:LiveReload 服务器正在端口 35729 上运行
该代码适用于我的 macOS catalina 和 STS 4 上的2.1.13.RELEASE和2.2.0.RELEASE 。
注意:来自spring-boot-devtools 上的 Spring 文档
自动重启因 IDE 而异。
红色标记的是 Eclipse 和 Intellij。
重新加载和重新启动之间有区别。
正在自动重启。
每次,我都在运行您的应用程序。 我收到此警告。
如何解决这个问题:
通过在 pom.xml 中为 spring-boot 执行器添加依赖项来抓取实时信息
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies>
但是您的应用程序仍然会重新启动。
使用 2.1.13.RELEASE 运行的应用程序的屏幕截图:
“abcd”作为基本字符串
我把它改成“abc”:
重启状态(对于 2.1.13.RELEASE):
重启状态(对于 2.2.0.RELEASE):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.