-
Feb 7th, 2012, 06:10 AM
#1
How to avoid duplicate bean definitions in Spring 3.1?
There is an API AbstractRefreshableApplicationContext.setAllowBean DefinitionOverriding() which seems to do the trick, but I can't find any usage examples.
The concrete non-web ApplicationContext classes I normally use do not extend AbstractRefreshableApplicationContext, and even for the Web contexts, the correct usage is not obvious:
- How do I set this attribute for an XmlWebApplicationContext or an AnnotationConfigWebApplicationContext - via an init-parameter in web.xml?
- How does this work with an AnnotationConfigApplicationContext?
- How does this work with a Test Context?
- Is there an equivalent XML attribute for XML configurations?
Best regards,
Harald
-
Feb 7th, 2012, 06:55 AM
#2
If you want to set this property you need to implement your own implementation/extension of the application context and set this property to false, there is no way of setting this by configuration. All application contexts have this property you only cannot set it by configuration. If you use java based configuration in a servlet 3.0 environment you would be able to set it but that is the only possible case (unless you use a standalone application and construct the context yourself).
-
Feb 7th, 2012, 07:08 AM
#3
Marten, thanks for your quick reply! This sounds like material for an enhancement request ;-)
Best regards,
Harald
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules