Go to file
Chris Beams 95b1dbadb0 Register nested @Configuration classes automatically
The following is now possible:

@Configuration
public class AppConfig {
    @Inject DataSource dataSource;

    @Bean
    public MyBean myBean() {
        return new MyBean(dataSource);
    }

    @Configuration
    static class DatabaseConfig {
        @Bean
        DataSource dataSource() {
            return new EmbeddedDatabaseBuilder().build();
        }
    }
}

public static void main(String... args) {
    AnnotationConfigApplicationContext ctx =
        new AnnotationConfigApplicationContext(AppConfig.class);
    ctx.getBean(MyBean.class);     // works
    ctx.getBean(DataSource.class); // works
}

Notice that the @Import annotation was not used and that only AppConfig
was registered against the context. By virtue of the fact that
DatabaseConfig is a member class of AppConfig, it is automatically
registered when AppConfig is registered. This avoids an awkward and
redundant @Import annotation when the relationship is already implicitly
clear.

See @Configuration Javadoc for details.

Issue: SPR-8186
2011-05-21 01:20:33 +00:00
build-spring-framework SPR-8352 Init and apply MappedInterceptors from AbstractHandlerMapping 2011-05-19 16:45:25 +00:00
org.springframework.aop Introduce @EnableTransactionManagement 2011-05-06 19:10:25 +00:00
org.springframework.asm
org.springframework.aspects revised cache abstraction 2011-05-18 18:34:41 +00:00
org.springframework.beans Rename {Default=>Standard}Environment 2011-05-20 03:53:37 +00:00
org.springframework.context Register nested @Configuration classes automatically 2011-05-21 01:20:33 +00:00
org.springframework.context.support
org.springframework.core Introduce ClassMetadata#getMemberClassNames 2011-05-21 01:20:03 +00:00
org.springframework.expression SPR-8211: property accessor ordering correction and removal of unnecessary duplicates 2011-05-12 16:40:44 +00:00
org.springframework.instrument
org.springframework.instrument.tomcat
org.springframework.integration-tests Rename {Default=>Standard}PortletEnvironment 2011-05-20 03:57:35 +00:00
org.springframework.jdbc SPR-6922 deprecated SimpleJdbcTemplate/SimpleJdbcOperations/SimpleJdbcDaoSupport in favor of JdbcTemplate/NamedParameterJdbcTemplate and related interfaces support classes 2011-04-14 18:44:40 +00:00
org.springframework.jms
org.springframework.orm Fix generics and serialization warnings 2011-05-06 19:00:14 +00:00
org.springframework.oxm SPR-8296 - Extension for CastorMarshaller - additional unmarshaller properties 2011-05-19 14:01:35 +00:00
org.springframework.spring-library
org.springframework.spring-parent Updating JUnit and TestNG versions for IDEs and Maven. 2011-03-28 19:59:09 +00:00
org.springframework.test Update MockEnvironment / MockPropertySource types 2011-05-06 18:57:41 +00:00
org.springframework.transaction Rename {Default=>Standard}Environment 2011-05-20 03:53:37 +00:00
org.springframework.web Rename {Default=>Standard}PortletEnvironment 2011-05-20 03:57:35 +00:00
org.springframework.web.portlet Rename {Default=>Standard}PortletEnvironment 2011-05-20 03:57:35 +00:00
org.springframework.web.servlet SPR-7353 Respect 'produces' condition in ContentNegotiatingViewResolver, improve selection of more specific media type in a pair 2011-05-20 17:02:20 +00:00
org.springframework.web.struts
spring-framework-reference SPR-7353 Doc update for consumes/produces + changelog update 2011-05-19 13:05:53 +00:00
src/test/java/org/springframework/core/env
.gitignore
build.properties
build.versions
ci-build.properties
eclipse-code-formatter.xml
spring-framework.ipr
spring-framework.psf