SEC-1369: Make sure beans aren't registered twice in case allowBeanDefinitionOverriding=false in the app context.

The use of registerBeanComponent() also registers the bean definition, which causes an error if overriding is disallowed and the bean has already been registered using registerBeanDefinition(). I've also set the allowBeanDefinitionOverriding to 'false' on InMemoryXmlApplicationContext to detect future mistakes of this kind in testing.
This commit is contained in:
Luke Taylor
2010-01-14 15:48:14 +00:00
parent 0f90e69004
commit 670297c55d
9 changed files with 28 additions and 32 deletions

View File

@@ -32,6 +32,7 @@ public class InMemoryXmlApplicationContext extends AbstractXmlApplicationContext
public InMemoryXmlApplicationContext(String xml, String secVersion, ApplicationContext parent) {
String fullXml = BEANS_OPENING + secVersion + ".xsd'>\n" + xml + BEANS_CLOSE;
inMemoryXml = new InMemoryResource(fullXml);
setAllowBeanDefinitionOverriding(false);
setParent(parent);
refresh();
}