相关疑难解决方法(0)

Spring jdbc模板如何解密密码?

这是我用来创建 DAO 对象的配置文件。

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans     
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context 
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<bean id="dataSource" 
      class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="url" value="jdbc:oracle:thin:@XXX.XX.XX.XXX:XXX:XXX"/>
   <property name="username" value="encryptedUsername"/>
   <property name="password" value="decrytedPassword"/>
</bean>

<bean id="fiBillJDBCTemplate" class="com.tfl.fi.billing.dao.FIBillingDAOImpl">
<property name="dataSource" ref="dataSource" />
</bean>

</beans>
Run Code Online (Sandbox Code Playgroud)

通常我们可以如下创建数据库对象

   ApplicationContext context = 
                 new ClassPathXmlApplicationContext("Parent.xml");
       FIBillingDAOImpl dao = 
          (FIBillingDAOImpl)context.getBean("fiBillJDBCTemplate");
Run Code Online (Sandbox Code Playgroud)

但这不起作用,因为存储在 xml 文件中的密码是加密的。

如何制作 DAO 对象以解密密码。

java spring-jdbc password-encryption

1
推荐指数
1
解决办法
6985
查看次数

标签 统计

java ×1

password-encryption ×1

spring-jdbc ×1