Reputation:
I have a basic spring boot application
Inside my application.properties file, I have placed below configuration,
server.ssl.enabled=true
server.ssl.key-store-type=JKS
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-password=password
server.ssl.key-alias=tomcat
keystore.jks is placed inside src/main/resources
Is there any way to add these configurations inside the java program and load the keystore.jks to enable https ?
Thanks
Upvotes: 1
Views: 890
Reputation: 120
You can use a YAML file instead of the application.properties file. The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath. We can also use coomand line arguments to specify the environment properties.
You can refer to the docs for more details.
Upvotes: 1
Reputation: 1299
In order to keep properties outside for executable file, you can use Spring Cloud Config Server. It has security features also.
If you need a database storage you can apply something custom like: Load spring boot app properties from database
Upvotes: 0