Results 1 to 2 of 2

Thread: Extending PropertyPlaceHolderConfig and Overriding convertPropertyValue()

  1. #1
    Join Date
    Aug 2004
    Location
    San Diego
    Posts
    6

    Default 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/ptwadapter.properties</value>
    </property>
    <property name="placeholderPrefix"><value>$test{</value></property>
    </bean>

    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">
    <value>$test{myString}</value>
    </property>
    </bean>

    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?

    Thanks!

  2. #2
    Join Date
    Aug 2004
    Location
    San Diego
    Posts
    6

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •