Spring 启动需要 spring-boot-starter-security 作为 ssl 的依赖项

Spring Boot requires spring-boot-starter-security as a dependency for ssl

我继承了Spring 引导应用程序(1.5.8 版)。我认为它读取外部 foo.properties 文件,然后创建具有 key/value 对的 Map 对象,然后 SpringApplication.setDefaultProperties 使用它。

当我检查属性文件时,它有很多 ssl 相关的 key/value 属性

server.ssl.key-alias=<some_value>
server.ssl.key-password=<some_value>
server.ssl.key-store=<some_value>
server.ssl.key-store-type=<some_value>

从它的 pom.xml 文件中我没有看到 spring-boot-starter-security 作为依赖项。我的假设是没问题。虽然作为新手,当我通过 Spring 关于 ssl 的引导的简单教程时,它有上述的 lib 作为依赖项。

我计划添加更多 ssl key/value 对,例如:

server.ssl.enabled=<some_value>
server.ssl.ciphers=<some_value>
server.ssl.protocol=<some_value>

我的问题是我是否需要 spring-boot-starter-security lib 作为依赖项。我确信我会在 update/execute 申请后发现,但我决定先询问是否有人提前知道。我最初的研究没有得出我正在寻找的答案。

更新: 从它的 pom.xml,我看到以下添加为依赖项。另一项研究尝试让我相信 spring-boot-starter 伴随着 spring-boot-starter-security 但我对此并不乐观。

spring-boot-starter
spring-boot-starter-log4j2
spring-boot-starter-web

没有

Spring 引导不需要 SSL 安全性,这是一个 Tomcat 问题。我推荐你阅读 this tutorial

不,您绝对不需要 spring-boot-starter-security 在 Spring 启动应用程序中启用 SSL/TLS。

Spring Boot documentation 中所述,您可以通过设置各种 server.ssl.* 属性以声明方式启用 SSL,通常在 application.propertiesapplication.yml.

参考Ssl class for details of all of the supported properties. You may also consider checking the Spring Boot common application properties (in special the server properties).