Announcement Announcement Module
No announcement yet.
Extending PropertyPlaceHolderConfig and Overriding convertPropertyValue() Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extending PropertyPlaceHolderConfig and Overriding convertPropertyValue()

    I have a class which extends PropertyPlaceholderConfigurer and overrides the convertPropertyValue() method that will decrypt properties which are encrypted. This works fine when all my beans are in one config file and I do not use the placeholder prefix functionality to allow me to not have to declare the properties bean in multiple files.

    My setup is such that I have one spring config file in WEB-INF which defines the prefix and uses my subclass of PropertyPlaceholderConfigurer:

    <bean id="properties" class="test.EncryptedPasswordPropertyPlaceholderCo nfigurer">
    <property name="location"> <value>classpath:dcgsn/config/ptwadapter/</value>
    <property name="placeholderPrefix"><value>$test{</value></property>

    Then I have another spring config file in WEB-INF which uses the prefix, but does not have the bean definition for the EncryptedPasswordPropertyPlaceholderConfigurer.

    <bean id="myAdapter"
    class="com.baesystems.dcgsn.service.MockSourceSele ctionAdapter">
    <property name="myParam">

    The values are decrypted fine for beans in the first config file, but in the second config file the values are not being decrypted in the convertPropertyValue() of the EcryptedPasswordPropertyPlaceholderConfigurer. It's like this method isn't being called and the values are just being set to the values that were in the properties file instead of being run through the convert method.

    The config files are initialized in a servlet.

    Is this a bug? I'm using Spring version 1.2.1. If it's not a bug, is there a way to work around this?


  • #2
    After doing further testing, I'm not sure if it doesn't call the convertPropertyValue() method or if it just doesn't pass the converted value to the second xml config and instead only passes the value as is from the property file itself.