Hi Arul,
Working against the latest M5 snapshot, the following works fine for me
Code:
package org.springframework.config.java.context;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.springframework.config.java.annotation.Bean;
import org.springframework.config.java.annotation.Configuration;
public class TempTests {
@Test
public void test() {
JavaConfigApplicationContext initialContext = new JavaConfigApplicationContext(ThreadConfig.class);
JavaConfigApplicationContext finalContext = new JavaConfigApplicationContext();
finalContext.setParent(initialContext);
finalContext.addConfigClass(AppConfig.class);
finalContext.addConfigClass(DataConfig.class);
finalContext.refresh();
finalContext.getBean(ThreadConfig.class);
finalContext.getBean(AppConfig.class);
finalContext.getBean(DataConfig.class);
assertThat(finalContext.getBean(String.class), equalTo("foostring"));
}
}
@Configuration class ThreadConfig {
public @Bean String foo() { return "foostring"; }
}
@Configuration class AppConfig { }
@Configuration class DataConfig { }
Thanks also for the correction on the documentation. It has been updated to reflect using addConfigClass() and addBasePackage() vs the older-style methods that have now been removed.