Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot logback.xml springproperty:如何解密密码_Spring Boot_Logback_Jasypt - Fatal编程技术网

Spring boot logback.xml springproperty:如何解密密码

Spring 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"

我们使用spring引导和logback,并在spring application.yaml中存储数据库用户名和加密密码。如何在logback.xml中获得解密的密码,以便dbAppender可以连接到数据库

谢谢你的帮助

应用程序.yaml

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
中实现它。因为它初始化得太早,而且加密的属性还没有准备好。请看