简体   繁体   中英

Using jasypt-spring-boot when deploying to Apache Tomcat

I'm trying to use the jasypt-spring-boot and deploy it to a Tomcat server as war. How to pass the encryptor password, in this case, to ensure the encrypted values could be read? All the provided example are about running a jar file or a Spring Boot app as follows:

java -Djasypt.encryptor.password={my-password-to-decrypt} -jar target/jasypt-spring-boot-demo-0.0.1-SNAPSHOT.jar

May be add some settings to catalina.properties file in the Tomcat conf folder as we do for example when defining active profile?

I figured out how to achieve that:

  • create a setenv.sh file in CATALINE_HOME/bin folder
  • add the following entry to set the environment variable on the Tomcat startup:
export JASYPT_ENCRYPTOR_PASSWORD=your-password
  • save and restart Tomcat.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM