Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      When Spring's beans-overriding property is set to false (bean overriding is forbidden), errors regarding duplicated beans are thrown (from Spring).

      After some debugging, I found the source of this problem in the following (and similar) lines inside the spring-security-config module.

      String id = pc.getReaderContext().registerWithGeneratedName(provider);
      pc.registerBeanComponent(new BeanComponentDefinition(provider, id));

      The problem is, that within the method registerWithGeneratedName, the method registerBeanDefinition is called (as the name says). This is also done when calling registerBeanComponent afterwards.

      In my opinion, the solution is to replace the codelines above with:

      String id = pc.getReaderContext().generateBeanName(provider);
      pc.registerBeanComponent(new BeanComponentDefinition(provider, id));

      The problematic code fragment can be found in different classes of the module multiple times.
      Replacing all occurrences solved the problem on our test cases. Also, all the tests of the whole Spring Security framework were passed successfully.

      I attach a patch which includes the modification that i have done.
      This was created from / for the 3.0.0.RELEASE tag.

      I hope, this can be helpful and will be integrated into the next release.

      Cheers

      Jonas

      1. patch-3.0.0.RELEASE.patch
        12 kB
        Jonas Hauenstein

        Activity

        Hide
        Luke Taylor added a comment -

        This is a good point - thanks for the patch. I've updated all the uses I could find where this pattern occurs and also changed the test context class to disallow bean overriding.

        Show
        Luke Taylor added a comment - This is a good point - thanks for the patch. I've updated all the uses I could find where this pattern occurs and also changed the test context class to disallow bean overriding.
        Hide
        Jonas Hauenstein added a comment -

        You are more than welcome!
        Also thank you for the fast fix of the issue. So we can use 3.0.1 as soon as it will be released without patching.
        Cheers

        Show
        Jonas Hauenstein added a comment - You are more than welcome! Also thank you for the fast fix of the issue. So we can use 3.0.1 as soon as it will be released without patching. Cheers

          People

          • Assignee:
            Luke Taylor
            Reporter:
            Jonas Hauenstein
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: