简体   繁体   English

部署到 Apache Tomcat 时使用 jasypt-spring-boot

[英]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.我正在尝试使用jasypt-spring-boot并将其部署到 Tomcat 服务器作为战争。 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:所有提供的示例都是关于运行jar文件或 Spring 引导应用程序,如下所示:

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?可以像我们在定义活动配置文件时所做的那样,向 Tomcat conf文件夹中的catalina.properties文件添加一些设置?

I figured out how to achieve that:我想出了如何实现这一目标:

  • create a setenv.sh file in CATALINE_HOME/bin folder在 CATALINE_HOME/bin 文件夹中创建一个setenv.sh文件
  • add the following entry to set the environment variable on the Tomcat startup:添加以下条目以在 Tomcat 启动时设置环境变量:
export JASYPT_ENCRYPTOR_PASSWORD=your-password
  • save and restart Tomcat.保存并重新启动 Tomcat。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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