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

GroovyBeanDefinitionReader does not fully support XML config files [SPR-12769] #17366

spring-issuemaster opened this issue Feb 28, 2015 · 1 comment


None yet
2 participants
Copy link

commented Feb 28, 2015

Sam Brannen opened SPR-12769 and commented

Status Quo

The class-level Javadoc for GroovyBeanDefinitionReader states the following.

This bean definition reader also understands XML bean definition files, allowing for seamless mixing and matching with Groovy bean definition files.

However, the support for XML configuration files is actually limited since GroovyBeanDefinitionReader disables XML validation for the XmlBeanDefinitionReader that it uses internally. As a consequence, certain standard features for XML configuration files do not work. For example, as discussed in #17365, the absence of XML validation causes the default value of the type attribute (defined in the spring-beans XSD) in the <qualifier> tag to be ignored, and this results in a BeanDefinitionParsingException when the ApplicationContext is loaded.


  1. Ensure that XML configuration files are fully supported when bean definitions are loaded via GroovyBeanDefinitionReader.

Affects: 4.0 GA

Issue Links:

  • #17365 XML config isn't fully supported for web integration tests if Groovy is on the classpath

Referenced from: commits e24a7de, 7edc7c2, b6f22aa


This comment has been minimized.

Copy link
Collaborator Author

commented Feb 28, 2015

Sam Brannen commented

Fixed as described in the comments for GitHub commits 7edc7c2 (4.2) and b6f22aa (4.1.6):

Fully support XML config in GroovyBeanDefinitionReader

Prior to this commit, the GroovyBeanDefinitionReader claimed (via its
Javadoc) that it fully supported XML configuration files in addition to
its Groovy DSL; however, this was unfortunately inaccurate since XML
validation was disabled by default which led to certain features of XML
configuration not working. For example, it was impossible to define a
<qualifier> in an XML config file without specifying the 'type'
attribute (which has a default value defined in the spring-beans XSD).

This commit fixes this issue by ensuring that bean definitions in XML
resources are loaded with a "standard" XmlBeanDefinitionReader that is
created with default settings (i.e., with XML validation enabled). With
regard to backwards compatibility, bean definitions defined using the
Groovy DSL are still loaded with an XmlBeanDefinitionReader that has
XML validation disabled by default which is necessary for proper
parsing of the Groovy DSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.