简体   繁体   English

将SSL添加到Spring Boot应用程序

[英]Adding SSL to Spring Boot application

With the command 用命令

keytool -genkey -alias localhost -keyalg RSA -keystore KeyStore.jks -keysize 2048

i generated keystore. 我生成了密钥库。 Next, I placed the generated file in resource and I have added to the configuration 接下来,我将生成的文件放在resource ,并添加到配置中

#server
server:
  ssl:
    key-store: classpath:KeyStore.jks
    key-store-password: JonkiPro
    key-password: JonkiPro

(I set the same passwords when generating the file) (我在生成文件时设置了相同的密码)

But the application has stopped working and the server does not respond. 但是该应用程序已停止工作,并且服务器没有响应。 The program compiles correctly but does not find the server https://zapodaj.net/e71e6875b721b.png.html 该程序可以正确编译,但是找不到服务器https://zapodaj.net/e71e6875b721b.png.html

Do I need to do something else? 我还需要做其他事情吗?

define the port of the server server.port=8443 server.ssl.key-store=classpath:keystore.jks server.ssl.key-store-password=secret server.ssl.key-password=another-secret 定义服务器的端口server.port=8443 server.ssl.key-store=classpath:keystore.jks server.ssl.key-store-password=secret server.ssl.key-password=another-secret

the application will no longer support plain HTTP connector at port 8080. Spring Boot doesn't support the configuration of both an HTTP connector and an HTTPS connector via application.properties 该应用程序将不再支持端口8080上的纯HTTP连接器。SpringBoot不支持通过application.properties来配置HTTP连接器和HTTPS连接器。

documentation 文件资料

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM