ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
"classpath:/applicationContext-core-test.xml");
assertNotNull(SpringContextHolder.getApplicationContext());
SpringContextHolder holderByName = SpringContextHolder.getBean("springContextHolder");
assertEquals(SpringContextHolder.class, holderByName.getClass());
SpringContextHolder holderByClass = SpringContextHolder.getBean(SpringContextHolder.class);
assertEquals(SpringContextHolder.class, holderByClass.getClass());
context.close();
assertNull(ReflectionUtils.getFieldValue(holderByName, "applicationContext"));
}