use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableCachingTests method emptyConfigSupport.
@Test
public void emptyConfigSupport() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
assertNotNull(ci.getCacheResolver());
assertEquals(SimpleCacheResolver.class, ci.getCacheResolver().getClass());
assertSame(context.getBean(CacheManager.class), ((SimpleCacheResolver) ci.getCacheResolver()).getCacheManager());
context.close();
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class ExpressionCachingIntegrationTests method expressionIsCacheBasedOnActualMethod.
// SPR-11692
@Test
@SuppressWarnings("unchecked")
public void expressionIsCacheBasedOnActualMethod() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(SharedConfig.class, Spr11692Config.class);
BaseDao<User> userDao = (BaseDao<User>) context.getBean("userDao");
BaseDao<Order> orderDao = (BaseDao<Order>) context.getBean("orderDao");
userDao.persist(new User("1"));
orderDao.persist(new Order("2"));
context.close();
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method defaultContainerFactory.
@Override
@Test
public void defaultContainerFactory() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsDefaultContainerFactoryConfig.class, DefaultBean.class);
testDefaultContainerFactoryConfiguration(context);
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method lazyComponent.
@Test
public void lazyComponent() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsDefaultContainerFactoryConfig.class, LazyBean.class);
JmsListenerContainerTestFactory defaultFactory = context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
assertEquals(0, defaultFactory.getListenerContainers().size());
// trigger lazy resolution
context.getBean(LazyBean.class);
assertEquals(1, defaultFactory.getListenerContainers().size());
MessageListenerTestContainer container = defaultFactory.getListenerContainers().get(0);
assertTrue("Should have been started " + container, container.isStarted());
// close and stop the listeners
context.close();
assertTrue("Should have been stopped " + container, container.isStopped());
}
use of org.springframework.context.ConfigurableApplicationContext in project spring-framework by spring-projects.
the class EnableJmsTests method customConfiguration.
@Override
@Test
public void customConfiguration() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EnableJmsCustomConfig.class, CustomBean.class);
testCustomConfiguration(context);
}
Aggregations