작성
·
241
0
@Test
public void lifeCycleTest() {
ConfigurableApplicationContext ac = new AnnotationConfigApplicationContext(LifeCycleConfig.class);
NetworkClient client = ac.getBean(NetworkClient.class);
ac.close();
}
@Configuration
static class LifeCycleConfig {
@Bean
public NetworkClient networkClient() {
NetworkClient networkClient = new NetworkClient();
networkClient.setUrl("http://hello.dev");
return networkClient;
}
}
여기에서 setUrl을 통해서 url을 지정했는대 ac.getBean(NetworkClient.class)에서는 왜 null이 나오는건지 잘 모르겠습니다.
네^^