title: Spring NamespaceHandler and multiple property placeholders
body: <p>I'm doing as follows:</p>
  
  <ul>
  <li>register a NamespaceHandler (with all spring.x files, the handler is properly located and invoked)</li>
  <li><p>in the Parser registered by the namespace handler, I load an xml file containing bean definitions (rather than defining them programmatically):</p>
  
  <pre><code>XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(parserContext.getRegistry());
  reader.loadBeanDefinitions(new ClassPathResource("definitions.xml"));
  </code></pre></li>
  <li><p>definitions.xml contains a <code>&lt;context:property-placeholder location="classpath:.. /&gt;</code></p></li>
  <li>the applicationContext.xml which invokes my handler needs to pass a property (e.g. <code>&lt;foo:bar prop="${baz}" /&gt;</code></li>
  <li>in the namespace handler I define an inline <code>PropertySource</code> and register it with the Environment, so that I can dynamically register a property that I need, which is based on the <code>prop</code> passed as attribute. I tried registering a String bean instead, but resolution fails.</li>
  </ul>
  
  <p>The property placeholder resolution happens after bean definitions, so happens after my code in the namespace handler's parser is invoked.</p>
  
  <p>However, this all fails. Multiple times, for multiple reasons. Here are they:</p>
  
  <ul>
  <li><p>if <code>&lt;context:property-placeholder /&gt;</code> is defined without <code>ignore-unresolvable="true"</code> and <code>order</code>, the first placeholder configurer fails to find properties required by the 2nd one. This is logical, of course, and seems to be mandatory whenever multiple placeholder configurers are used</p></li>
  <li><p>because the dynamic property is based on the passed <code>prop</code>, it looks like <code>file://${prop}/foo", which means it is a nested property. You can't configure the behaviour of nested property resolution per configurer, which means even though</code>ignore-unresolvable` is true, nested properties are not ignored, and the whole thing fails.</p></li>
  </ul>
  
  <p>The solution I found is to get the <code>AbstractEnvironment</code> in the namespace handler's parser, and set the call <code>env.setIgnoreUnresolvableNestedPlaceholders(true)</code></p>
  
  <p>This looks like a hack though. So my questions are:</p>
  
  <ul>
  <li>how to dynamically register properties that will later be resolved?</li>
  <li>how to configure ignoring nested property resolution per configurer?</li>
  <li>is there a better way to achieve what I need - namely, include a "bundle" of definitions via a custom namespace, and pass properties (loaded from file) to them?</li>
  </ul>
  
  <p>P.S. Spring improvement request posted: <a href="https://jira.springsource.org/browse/SPR-10654" rel="nofollow">https://jira.springsource.org/browse/SPR-10654</a></p>