in my applicationContext-resources.xml, I have:
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" />
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
<bean id="propertyConfigurer"
class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:mail.properties</value>
<value>classpath:socketserver.properties
</value>
</list>
</property>
</bean>
<bean id="password" class="java.lang.String">
<constructor-arg value="${jdbc.password}" />
</bean>
In my jdbc.properties, I have my
jdbc.password=ENC(aaHCKW3xbcNcxUsTQfEdyA==)
I have a test case like this:
@ContextConfiguration(locations={"classpath:applicationContext-resources.xml"})
public class PasswordTest extends AbstractJUnit4SpringContextTests{
@Autowired
private String password;
@Autowired
EnvironmentStringPBEConfig environmentVariablesConfiguration;
@Autowired
DriverManagerDataSource dataSource;
@Test
public void testOne() {
System.out.println(password);
System.out.println(dataSource.getPassword());
}
}
I see the password is still not decrypted
ENC(aaHCKW3xbcNcxUsTQfEdyA==)
ENC(aaHCKW3xbcNcxUsTQfEdyA==)
Can someone tell me what I it is that I'm doing wrong?
Rahul Somasunderam