springboot启动时开启https协议

cd到jdk的bin目前

.\keytool -genkey -alias tomcat  -storetype PKCS12 -keyalg RSA -keysize 2048  -keystore keystore.p1 -validity 3650

记住输入的密码

1.-storetype 指定密钥仓库类型
2.-keyalg 生证书的算法名称,RSA是一种非对称加密算法
3.-keysize 证书大小
4.-keystore 生成的证书文件的存储路径
5.-validity 证书的有效期

将生成的文件放在目录的根目录下

application.yaml的配置

server:
  port: 10000
  ssl:
    key-store: keystore.p1
    key-store-password: 123456
    key-store-type: PKCS12
    key-alias: tomcat

然后启动项目
就可以看到https:localhost:10000

猜你喜欢

转载自blog.csdn.net/chaogaoxiaojifantong/article/details/108639634
今日推荐