How can I specify my .keystore file with Spring Boot and Tomcat?

后端 未结 5 1287
面向向阳花
面向向阳花 2020-12-04 09:20

I\'m trying to set up Spring Security to work with Spring Boot\'s embedded Tomcat instance. There are quite a few basic samples that do this but I\'m stuck where they leave

5条回答
  •  [愿得一人]
    2020-12-04 10:07

    Starting with Spring Boot 1.2, you can configure SSL using application.properties or application.yml. Here's an example for application.properties:

    server.port = 8443
    server.ssl.key-store = classpath:keystore.jks
    server.ssl.key-store-password = secret
    server.ssl.key-password = another-secret
    

    Same thing with application.yml:

    server:
      port: 8443
      ssl:
        key-store: classpath:keystore.jks
        key-store-password: secret
        key-password: another-secret
    

    Here's a link to the current reference documentation.

提交回复
热议问题