Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-6050

Provide mechanism for disabling automatic annotation-driven autowiring in tests

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.5.6
    • Fix Version/s: None
    • Component/s: Test
    • Labels:
      None

      Description

      In the Spring TestContext Framework (i.e., specifically in AbstractGenericContextLoader), annotation-driven autowiring is automatically enabled. In other words, all ApplicationContexts created by subclasses of AbstractGenericContextLoader (e.g., GenericXmlContextLoader) are automatically configured to process annotations.

      If you explicitly wish that annotation processing not be enabled for the configuration files you specify – for example, if some of the beans are annotated with @Autowired, etc. but you do not want those beans to be autowired – you are at a loss: there is currently no way to disable this.

      As indirectly suggested in the forum, it would be nice if Spring provided a mechanism for disabling automatic annotation-driven autowiring in tests.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sbrannen Sam Brannen
                Reporter:
                sbrannen Sam Brannen
                Last updater:
                Sam Brannen
              • Votes:
                2 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 15 weeks, 6 days ago