十年網站開發(fā)經驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網站問題一站解決
1.通過命令生成證書文件
伊吾網站建設公司創(chuàng)新互聯(lián)公司,伊吾網站設計制作,有大型網站制作公司豐富經驗。已為伊吾上1000+提供企業(yè)網站建設服務。企業(yè)網站搭建\成都外貿網站制作要多少錢,請找那個售后服務好的伊吾做網站的公司定做!
keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore ./keystore.p12 -validity 3650
回車后輸入密碼及其他相關信息
2.將生成的keystore.p12證書文件復制到Spring Boot的resource目錄,與application.properties目錄同級
3.在application.properties中添加如下配置
## 支持Https,通過以下命令生成自簽名證書
## keytool -genkey -alias https-integration -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore ./keystore.p12 -validity 3650
# The format used for the keystore
server.ssl.keyStoreType=PKCS12
# The path to the keystore containing the certificate
server.ssl.key-store=classpath:keystore.p12
## The password used to generate the certificate
server.ssl.key-store-password=123456
# The alias mapped to the certificate
server.ssl.keyAlias=tomcat
4.注意
此配置生效后僅支持https,http請求將不再支持