For security reasons, I have to store the passwords in an external application.yml
(outside the war
), which should be loaded by the deployed war
on runtime.
Do you know where do I have to place the external configuration file? Do I have to configure some properties?
Thank you in advance!
I assume you have a war file which contains a spring-boot application, in general there are more options to manage your properties, check out the document here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
I will recommend you 2 different approaches:
java -jar myproject.war --spring.config.location=file:/default.properties
If you want to store confidential data in the server, then please add <Environment>
to the context.xml
file of tomcat server. Example: <Environment name="user.password" value="XXXXXXXX" type="java.lang.String" override="false"/>
. You can access them as properties in spring context.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.