Spring boot logback.xml springproperty:如何解密密码
我们使用spring引导和logback,并在spring application.yaml中存储数据库用户名和加密密码。如何在logback.xml中获得解密的密码,以便dbAppender可以连接到数据库 谢谢你的帮助 应用程序.yamlSpring boot logback.xml springproperty:如何解密密码,spring-boot,logback,jasypt,Spring Boot,Logback,Jasypt,我们使用spring引导和logback,并在spring application.yaml中存储数据库用户名和加密密码。如何在logback.xml中获得解密的密码,以便dbAppender可以连接到数据库 谢谢你的帮助 应用程序.yaml datasource: username: root password: ENC(xxxxxxxxxxxxxxxxx) logback.xml <springProperty scope="context"
datasource:
username: root
password: ENC(xxxxxxxxxxxxxxxxx)
logback.xml
<springProperty scope="context" name="db.user" source="datasource.username"/>
<springProperty scope="context" name="db.password" source="datasource.password"/>
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://host_name:3306/datebase_name</url>
<username>${db.user}</username>
<password>${db.password}</password>
</connectionSource>
</appender>
com.mysql.jdbc.Driver
jdbc:mysql://host_name:3306/datebase_name
${db.user}
${db.password}
对于加密属性,请使用
有关在logback中使用属性的信息,请参阅
但是,您实际上无法在
logbackspring.xml
中实现它。因为它初始化得太早,而且加密的属性还没有准备好。请参阅。有关加密属性,请使用
有关在logback中使用属性的信息,请参阅
但是,您实际上无法在logbackspring.xml
中实现它。因为它初始化得太早,而且加密的属性还没有准备好。请看