Results 1 to 3 of 3

Thread: How to avoid duplicate bean definitions in Spring 3.1?

  1. #1

    Default 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

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    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).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    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
  •