Skip to content
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

DefaultBeanDefinitionDocumentReader should ignore the 'profile' attribute for custom namespaces [SPR-11975] #16591

spring-projects-issues opened this issue Jul 8, 2014 · 0 comments
type: enhancement


Copy link

@spring-projects-issues spring-projects-issues commented Jul 8, 2014

Oliver Becker opened SPR-11975 and commented

The JavaDoc of the class org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader says

<beans> doesn't need to be the root element of the XML document: This class will parse all bean definition elements in the XML file, not regarding the actual root element.

Indeed parseBeanDefinitions() will call parseCustomElement() if the element is not a Spring element.

However, doRegisterBeanDefinitions always evaluates the profile attribute of the root element against the environment, thus ignoring the element completely if the evaluated profile is not active. The problem is: if the root element is not a <beans> element, the profile attribute must be ignored (because the attribute might have an entirely different meaning).

We are using custom elements in our framework based on Spring and the profile evaluation breaks some of our XML files.

Proposed solution: add delegate.isDefaultNamespace(root) in doRegisterBeanDefinitions before the profile evaluation.

Affects: 4.0.6

Referenced from: commits a6a86b8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
type: enhancement
None yet

No branches or pull requests

2 participants