title: How to decrypt a property value when using PropertySourcesPlaceholderConfigurer
body: <p>I have a properties file containing values like <code>jdbc.password={enc}laksksjdjdj</code></p>
  
  <p>Using JDK 1.7 and Spring 4.1.5 my configuration class looks like this</p>
  
  <pre><code>@PropertySources({
      @PropertySource("classpath:application.properties"),
      @PropertySource("classpath:env.properties")
  })
  @ComponentScan("com.acme")
  @Configuration
  public class SpringConfig
  {
      @Autowired
      private ConfigurableEnvironment env;    
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer()
      {
          return new EncryptedPropertySourcesPlaceholderConfigurer();
      }
  }
  </code></pre>
  
  <p>What I am trying to achieve is to translate <em>any</em> values in my properties file from an encrypted value to the actual value. Some values will be encrypted and some won't. This is what I have attempted so far and when I place a breakpoint on <code>convertProperties()</code> the <code>props</code> argument is always empty. I can't make any sense of this because I can see that at this point <code>this.environment</code> is loaded with all the properties from the files.</p>
  
  <pre><code>public class EncryptedPropertySourcesPlaceholderConfigurer extends PropertySourcesPlaceholderConfigurer
  {
      @Override 
      protected void convertProperties(Properties props)
      {
          Enumeration&lt;?&gt; propertyNames = props.propertyNames();
  
          while (propertyNames.hasMoreElements()) {
  
              String propertyName = (String) propertyNames.nextElement(); 
              String propertyValue = props.getProperty(propertyName); 
  
              // String convertedValue = &lt;translate the value&gt;;
  
              props.setProperty(propertyName, convertedValue);
          } 
      }
  
      @Override
      protected Properties mergeProperties() throws IOException {
          final Properties mergedProperties = super.mergeProperties();
          convertProperties(mergedProperties);
          return mergedProperties;
      }
  }
  </code></pre>
  
  <p>Has anyone been able to achieve this using <code>PropertySourcesPlaceholderConfigurer</code>? I have similar logic working in older applications using <code>PropertyPlaceholderConfigurer</code> but wanted to use the newer Spring configuration.</p>
  
  <p>I noticed that Jasypt has a similar <code>EncryptablePropertySourcesPlaceholderConfigurer</code> but this behaves in the same fashion, so I'm confused.</p>