use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class NashornScriptTemplateTests method createViewWithUrl.
private ScriptTemplateView createViewWithUrl(String viewUrl, Class<?> configuration) throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(configuration);
ctx.refresh();
ScriptTemplateView view = new ScriptTemplateView();
view.setApplicationContext(ctx);
view.setUrl(viewUrl);
view.afterPropertiesSet();
return view;
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class ServerEndpointRegistrationTests method endpointPerConnection.
@Test
public void endpointPerConnection() throws Exception {
@SuppressWarnings("resource") ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
ServerEndpointRegistration registration = new ServerEndpointRegistration("/path", EchoEndpoint.class);
registration.setBeanFactory(context.getBeanFactory());
EchoEndpoint endpoint = registration.getConfigurator().getEndpointInstance(EchoEndpoint.class);
assertNotNull(endpoint);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnableCachingIntegrationTests method repositoryIsClassBasedCacheProxy.
@Test
public void repositoryIsClassBasedCacheProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, ProxyTargetClassCachingConfig.class);
ctx.refresh();
assertCacheProxying(ctx);
assertThat(AopUtils.isCglibProxy(ctx.getBean(FooRepository.class)), is(true));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class ScheduledAndTransactionalAnnotationIntegrationTests method failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface.
@Test
public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, JdkProxyTxConfig.class, RepoConfigA.class);
try {
ctx.refresh();
fail("Should have thrown BeanCreationException");
} catch (BeanCreationException ex) {
assertTrue(ex.getRootCause() instanceof IllegalStateException);
}
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnableTransactionManagementIntegrationTests method repositoryIsTxProxy_withDefaultTxManagerName.
@Test
public void repositoryIsTxProxy_withDefaultTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, DefaultTxManagerNameConfig.class);
ctx.refresh();
assertTxProxying(ctx);
}
Aggregations