title: How to access @ConfigurationProperties bean by it's name from XML configuration?
body: <p>Suppose I have an <code>AppProperties</code> POJO annotated with <code>@ConfigurationProperties("app")</code>. It contains different app properties which I usually use to configure my beans in <code>@Configuration</code> classes. 
  <code>@EnableConfigurationProperties(AppProperties.class)</code> makes it available for <code>@Autowiring</code>, this is very convenient for Java-configuration.</p>
  
  <p>But one part of my app's context is configured using old-fashined XML-confiuration. I would like to know how can I access <code>@ConfigurationProperties AppProperties</code> bean in XML configuration? If only <code>@EnableConfigurationProperties</code> provided me an ability to give a <code>name</code>, I could probably use SpEL in XML like this: <code>#{appProperties.requiredProp}</code> (I would really like to achieve it). </p>
  
  <p>Unfortunately I do not see a way to provide the name and my attempt to use suggested <code>appProperties</code> name fails with:</p>
  
  <blockquote>
    <p>SpelEvaluationException: EL1008E: Property or field 'appProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public or not valid?</p>
  </blockquote>
  
  <p>I've seen in debugger that the bean is actually called <code>app-my.package.AppProperties</code> which is not obvious and never stated explicitly.</p>
  
  <p>In JavaDoc for <code>@EnableConfigurationProperties</code> I noticed the following:</p>
  
  <blockquote>
    <p><code>@ConfigurationProperties</code> beans can be registered in the standard way (for example using <code>@Bean</code> methods) or, for convenience, can be specified directly on this (<code>@EnableConfigurationProperties</code>) annotation.</p>
  </blockquote>
  
  <p>Does this mean I can somehow get a named instance of <code>AppProperties</code> with values injected from <code>application.properties</code> using either <code>@Bean</code> method in Java or <code>&lt;bean/&gt;</code> in XML?</p>
  
  <p>Of course, I could autowire the whole <code>AppProperties</code> to the class configured with XML, but I do not think it is a good design solution, because am only interested in a single <code>String</code> property from <code>AppProperties</code>. Probably I should not try to use this "type-safe" properties manner in XML and just stick to old way: using <code>${}</code>-resolution, but I feel like I am missing something in the <code>@ConfigurationProperties</code> concept so please let me know.</p>