【发布时间】:2020-02-16 01:16:59
【问题描述】:
在spring boot应用的application.properties中可以定义很多属性。
但我想传递属性来配置 ssl 以从代码内部弹出。
server.ssl.enabled=true
# The format used for the keystore
server.ssl.key-store-type=PKCS12
# The path to the keystore containing the certificate
server.ssl.key-store=keys/keystore.jks
# The password used to generate the certificate
server.ssl.key-store-password=changeit
# The alias mapped to the certificate
server.ssl.key-alias=tomcat
因此,这些将是从 application.properties 中使用的 spring 定义的属性。我只是想根据一些逻辑从代码中设置它们。
对于非 spring 应用程序,我仍然有一些想法,它们可以作为应用程序、会话或上下文属性传递,但我不知道它在 spring 中是如何工作的。
任何帮助将不胜感激。
【问题讨论】:
标签: java spring spring-boot properties