title: Spring PropertiesFactoryBean that automatically exposes a PropertyPlaceholderConfigurer's property
body: <p>Ideally I'd like to do this from code:</p>
  
  <pre><code>@Value("#{aPropertiesFactoryBean.aProperty}")
  private String aProperty;
  </code></pre>
  
  <p>Based on a spring configuration where I set up a PropertyPlaceholderConfigurer and a PropertiesFactoryBean, and just pass the configurer bean as a ref to the bean, and everything that the configurer generates is exposed as a property of the factory bean.</p>
  
  <p>There is a hack to just redefine every property from the Configurer like:</p>
  
  <pre><code>&lt;bean id="aPropertiesFactoryBean" 
        class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
      &lt;property name="singleton" value="true" /&gt;
      &lt;property name="properties"&gt;
        &lt;props&gt;
          &lt;prop key="aProperty"&gt;${aProperty}&lt;/prop&gt;
        &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And then every time you add a property to the Configurer, you have to re-expose it with the FactoryBean.  And the punchline is, I want all the management features of the configurer, and also be able to reference the same batch of properties from both the spring xml files, and @Value annotations.</p>
  
  <p>So the two questions:</p>
  
  <ol>
  <li>Is there something like this out of the box? </li>
  <li>It looks like it would be simple to override PropertiesFactoryBean and give it a property for the PlaceholderConfigurer, but the code to actually access the properties would have to involve unwelding the hood through reflection and digging into Spring's internal PropertiesLoaderSupport class.  Is there a less hacky way to do this?</li>
  </ol>
  
  <p>Note, I'm not looking for something that can just quickly get me on my way, the above hack with PropertiesFactoryBean suffices for now.  I'm looking to either find or make a reusable component that I can use to easily manage injectable properties for projects down the road.</p>