有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Spring启动启用HTTPS

我使用Spring Boot 2.3创建微服务。我需要启用HTTPS并禁用HTTP调用。我有你的证书。pfx格式。我从https://www.thomasvitale.com/https-spring-boot-ssl-certificate/尝试了以下步骤

server.port=8443

server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:mycert.pfx
server.ssl.key-store-password=password
security.require-ssl=true

由于我们使用的是spring boot安全性,下面也添加了一些内容

   http
        .requiresChannel()
        .anyRequest()
        .requiresSecure();

在WebSecurityConfigureAdapter的配置方法中。但是,通过这些配置,我能够获得HTTP和HTTPS的响应。因此,我不确定HTTPS是否真的像我配置的那样工作,但它不工作。在key store属性中提到pfx文件对吗


共 (0) 个答案