Search in sources :

Example 81 with AnnotationConfigApplicationContext

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;
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext)

Example 82 with AnnotationConfigApplicationContext

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);
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 83 with AnnotationConfigApplicationContext

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));
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 84 with AnnotationConfigApplicationContext

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);
    }
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 85 with AnnotationConfigApplicationContext

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);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Aggregations

AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)800 Test (org.junit.Test)528 DSLContext (org.jooq.DSLContext)53 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)42 ApplicationContext (org.springframework.context.ApplicationContext)25 Before (org.junit.Before)23 DIConfiguration (com.khartec.waltz.service.DIConfiguration)15 Filter (javax.servlet.Filter)15 Map (java.util.Map)14 OncePerRequestFilter (org.springframework.web.filter.OncePerRequestFilter)14 TestBean (org.springframework.tests.sample.beans.TestBean)13 PropertyPlaceholderAutoConfiguration (org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration)12 MockMvc (org.springframework.test.web.servlet.MockMvc)12 EntityKind (com.khartec.waltz.model.EntityKind)11 List (java.util.List)10 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)10 MockEnvironment (org.springframework.mock.env.MockEnvironment)10 EntityReference (com.khartec.waltz.model.EntityReference)9 MapPropertySource (org.springframework.core.env.MapPropertySource)9 IOException (java.io.IOException)8