我以前从未做过,而且大多数教程都没有提到如何处理.crt文件。
我从GoDaddy购买了SSL证书,并在下载时选择了Tomcat作为平台。压缩文件包含3个文件:
dea08asdjakjawl.crt
gd_bundle-g1-g1.crt
gdig.crt.pem
Run Code Online (Sandbox Code Playgroud)
我在CentOS7服务器上有一个正在运行的Spring Boot应用程序(在具有嵌入式Tomcat的端口80上)。(服务器在Digital Ocean上运行,它具有分配的域,并且可以使用简单的http)
我想将其切换到https://something.com
所有教程都建议我为此必须具有.jks或.p12文件,但无法将.crt文件转换为该文件。此外,我不确定2 .crt文件中的哪个应转换为.jks / .p12。
我已将此添加到我的application.yaml中,但没有帮助:
server:
port: 443
ssl:
enabled: true
key-alias: server
key-store: "cert.crt"
key-store-password: "***"
Run Code Online (Sandbox Code Playgroud)
如何使用此证书将正在运行的Spring Boot项目更改为接受HTTPS查询?
到目前为止,我正在创建这样的终点:
@RequestMapping(value = "/test", method = RequestMethod.POST)
public @ResponseBody String indexPost(HttpServletRequest request, HttpServletResponse response)
throws Exception {
//Doing calculations
return "Result";
}
Run Code Online (Sandbox Code Playgroud)
但我想在服务器启动时到达application.properties,读出存储的数据,如下所示:
methods: {
"endpointOne": "DBStoredProcedure1",
"endpointTwo": "DBStoredProcedure2"
}
Run Code Online (Sandbox Code Playgroud)
因此,当我的Spring Boot应用程序启动时,它将基于属性文件创建所有POST端点,其中包含第一个参数的名称(如"endpointOne"),并将调用(并返回结果)定义的存储过程作为第二个参数(如"DBStoredProcedure1").
有可能吗?