Skip to content

convertPropertyValue (for reading encrypted values) not working [SPR-14001] #18574

Closed
@spring-projects-issues

Description

@spring-projects-issues

Alireza Fattahi opened SPR-14001 and commented

As mentioned in http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/config/PropertyResourceConfigurer.html:

the convertPropertyValue method has been documented as:

Convert the given property value from the properties source to the value which should be applied.
The default implementation simply returns the original value. Can be overridden in subclasses, for example to detect encrypted values and decrypt them accordingly.

So instead of using:

<context:property-placeholder location="classpath:/configs/*.properties,classpath:/configs/bsi/*-config.properties" />

I used this:

<bean class="foo.bar.security.DecryptPropertyConfigurer">
   <property name="locations">
       <list>
           <value>classpath:/configs/*.properties</value>
           <value>classpath:/configs/bsi/*-config.properties</value>
       </list>
   </property>  
   </bean>

an the new PropertySourcesPlaceholderConfigurer is defined as:

public class DecryptPropertyConfigurer extends PropertySourcesPlaceholderConfigurer {

    @Override
    protected String convertPropertyValue(String originalValue){
        //for some properties, do some conversions
    }

}

The convert method is never called. Am I missing some thing our this is a bug?!


Affects: 4.2.4

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions