Skip to content

@Component within @Configuration class cannot @Autowire Regression [SPR-10865] #15492

@spring-projects-issues

Description

@spring-projects-issues

Rob Winch opened SPR-10865 and commented

The following test passes with Spring 3.2.3.RELEASE and with Spring 4.0.0.M1, but fails with 4.0.0.M2 and the current snapshot (i.e. conceptually this is 4.0.0.M3-SNAPSHOT)

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ComponentConfigTests.MyConfig.class})
public class ComponentConfigTests {
    @Autowired
    private MyConfig.MyComponent component;

    @Test
    public void componentAutowiresSuccessfully() {
    }

    @Configuration
    static class MyConfig {
        @Component
        public static class MyComponent {
        }
    }
}

These failures are causing test failures in Spring Security's tests when ran against Spring 4 that relate to issue 55 from the Spring Security Java Config project (which is now part of Spring Security).


Affects: 4.0 M2, 4.0 M3

Attachments:

Issue Links:

Referenced from: commits 9bfbe36

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions