New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow a Spring 2 NamespaceHandler to invoke the Spring registered PropertyPlaceholderConfigurer on the XML Element before processing [SPR-4466] #9143
Comments
Juergen Hoeller commented The problem there is that NamespaceHandlers are processed in a pre-bean-initialization phase, with bean bootstrapping - and hence PropertyPlaceholderConfigurer bootstrapping - kicking in one phase later. The main reason for this is that NamespaceHandlers may register further beans, which may even turn out to be further BeanFactoryPostProcessors... hence all those NamespaceHandlers have to be fully processed before the bean post-processing phase begins. We'll revisit this for Spring 3.0. Juergen |
Tuomas Kiviaho commented I was planning myself to use javax.el (JUEL, https://jsp.dev.java.net, etc.) for parsing purposes leveraging BeanDefinitionVisitor similar to PropertyPlaceholderConfigurer . I noticed from missing RuntimeBeanNameReference support that org.springframework.beans.factory.support.BeanDefinitionValueResolver doesn't make use of org.springframework.beans.factory.config.BeanDefinitionVisitor which is key part of PropertyPlaceholderConfigurer. For namespace handler purposes I could imagine xpath suiting better than expressions when referencing XML itself instead of bean definitions. At least with JAXB annotation one could implement unmarshalling based on existence of Tuomas |
Martin Gilday commented Please see the following issues for examples: http://issues.apache.org/activemq/browse/CAMEL-674 |
Leoš Bitto commented I think that the problem with PropertyPlaceholderConfigurer which is a BeanFactoryPostProcessor is that currently the Spring Framework is not flexible enough with ordering of the BeanFactoryPostProcessors. Check my issue #10298 to see another result of this inflexibility and a suggestion for an improvement - I hope that the NamespaceHandlers could be rewriten to be BeanFactoryPostProcessors, given the proper ordering of the BeanFactoryPostProcessors... |
Peter Chandler commented Maybe related to my Apache Camel issue using PropertyPlaceholderConfigurer: Caused by: java.lang.IllegalArgumentException: Invalid directory: ${atis.in.directory}. Dynamic expressions with ${ } placeholders is not allowed. Use the fileName option to set the dynamic expression. |
Bulk closing outdated, unresolved issues. Please, reopen if still relevant. |
James Strachan opened SPR-4466 and commented
If someone implemented the NamespaceHandler using some XML marshalling framework (xstream / jaxb or whatever) then they loose the ability to use ${foo} notation within the XML attributes/text values.
It would be nice if from the ParserContext or some other place we could invoke Spring with the Element and ask it to invoke the PropertyPlaceholderConfigurer (or whatever) is configured there to expand any uses of ${foo} in the XML before processing.
Looking at the code, I don't see any easy way to reuse that. We'd have to basically cut n paste the code from PropertyPlaceholderConfigurer to do the interpolation and would have no idea how the user has configured the property resolution etc.
Affects: 2.5.1
18 votes, 17 watchers
The text was updated successfully, but these errors were encountered: