org.springframework.context.annotation.AnnotationConfigApplicationContext.register() - java examples

Here are the examples of the java api org.springframework.context.annotation.AnnotationConfigApplicationContext.register() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

18 View Complete Implementation : AbstractReactiveWebInitializer.java
Copyright MIT License
Author : codeEngraver
/**
 * Return the Spring configuration that contains application beans including
 * the ones detected by {@link WebHttpHandlerBuilder#applicationContext}.
 */
protected ApplicationContext createApplicationContext() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    Clreplaced<?>[] configClreplacedes = getConfigClreplacedes();
    replacedert.notEmpty(configClreplacedes, "No Spring configuration provided through getConfigClreplacedes()");
    context.register(configClreplacedes);
    return context;
}

18 View Complete Implementation : JythonScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

18 View Complete Implementation : NashornScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

18 View Complete Implementation : JRubyScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

18 View Complete Implementation : NashornScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

18 View Complete Implementation : JRubyScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

18 View Complete Implementation : AbstractReactiveWebInitializer.java
Copyright MIT License
Author : Vip-Augus
/**
 * Return the Spring configuration that contains application beans including
 * the ones detected by {@link WebHttpHandlerBuilder#applicationContext}.
 */
protected ApplicationContext createApplicationContext() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    Clreplaced<?>[] configClreplacedes = getConfigClreplacedes();
    replacedert.notEmpty(configClreplacedes, "No Spring configuration provided through getConfigClreplacedes()");
    context.register(configClreplacedes);
    return context;
}

18 View Complete Implementation : JythonScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : NashornScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

17 View Complete Implementation : EnableAsyncTests.java
Copyright MIT License
Author : Vip-Augus
/**
 * Fails with clreplacedpath errors on trying to clreplacedload AnnotationAsyncExecutionAspect.
 */
@Test(expected = BeanDefinitionStoreException.clreplaced)
public void aspectModeAspectJAttemptsToRegisterAsyncAspect() {
    @SuppressWarnings("resource")
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(AspectJAsyncAnnotationConfig.clreplaced);
    ctx.refresh();
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : Vip-Augus
@Test
public void noCacheManagerBeans() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EmptyConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (IllegalStateException ex) {
        replacedertTrue(ex.getMessage().contains("no bean of type CacheManager"));
    }
}

17 View Complete Implementation : Spr9031Tests.java
Copyright MIT License
Author : Vip-Augus
/**
 * Use of @Import to register LowLevelConfig results in ASM-based annotation
 * processing.
 */
@Test
public void withAsmAnnotationProcessing() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(HighLevelConfig.clreplaced);
    ctx.refresh();
    replacedertThat(ctx.getBean(LowLevelConfig.clreplaced).scanned, not(nullValue()));
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : Vip-Augus
@Test
public void multipleCacheManagerBeans() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiCacheManagerConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (IllegalStateException ex) {
        replacedertTrue(ex.getMessage().contains("no unique bean of type CacheManager"));
    }
}

17 View Complete Implementation : ScheduledAndTransactionalAnnotationIntegrationTests.java
Copyright MIT License
Author : Vip-Augus
@Test
public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced, JdkProxyTxConfig.clreplaced, RepoConfigA.clreplaced);
    try {
        ctx.refresh();
        fail("Should have thrown BeanCreationException");
    } catch (BeanCreationException ex) {
        replacedertTrue(ex.getRootCause() instanceof IllegalStateException);
    }
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void noCacheManagerBeans() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EmptyConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (IllegalStateException ex) {
        replacedertTrue(ex.getMessage().contains("no bean of type CacheManager"));
    }
}

17 View Complete Implementation : RequestMappingExceptionHandlingIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
    wac.register(WebConfig.clreplaced);
    wac.refresh();
    return wac;
}

17 View Complete Implementation : Spr8808Tests.java
Copyright MIT License
Author : Vip-Augus
/**
 * This test failed with ConflictingBeanDefinitionException prior to fixes for
 * SPR-8808.
 */
@Test
public void repro() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced);
    ctx.refresh();
}

17 View Complete Implementation : Spr9031Tests.java
Copyright MIT License
Author : Vip-Augus
/**
 * Direct registration of LowLevelConfig results in reflection-based annotation
 * processing.
 */
@Test
public void withoutAsmAnnotationProcessing() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(LowLevelConfig.clreplaced);
    ctx.refresh();
    replacedertThat(ctx.getBean(LowLevelConfig.clreplaced).scanned, not(nullValue()));
}

17 View Complete Implementation : JRubyScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : GroovyMarkupViewTests.java
Copyright MIT License
Author : codeEngraver
private GroovyMarkupView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(GroovyMarkupConfiguration.clreplaced);
    ctx.refresh();
    GroovyMarkupView view = new GroovyMarkupView();
    view.setUrl(viewUrl);
    view.setApplicationContext(ctx);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : KotlinScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

17 View Complete Implementation : ControllerInputIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
    wac.register(WebConfig.clreplaced, TestRestController.clreplaced);
    wac.refresh();
    return wac;
}

17 View Complete Implementation : KotlinScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

17 View Complete Implementation : LocaleContextResolverIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(WebConfig.clreplaced);
    context.refresh();
    return context;
}

17 View Complete Implementation : Spr8808Tests.java
Copyright MIT License
Author : codeEngraver
/**
 * This test failed with ConflictingBeanDefinitionException prior to fixes for
 * SPR-8808.
 */
@Test
public void repro() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced);
    ctx.refresh();
}

17 View Complete Implementation : BridgeMethodAutowiringTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void SPR8434() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(UserServiceImpl.clreplaced, Foo.clreplaced);
    ctx.refresh();
    replacedertNotNull(ctx.getBean(UserServiceImpl.clreplaced).object);
}

17 View Complete Implementation : WebFluxConfigurationSupportTests.java
Copyright MIT License
Author : codeEngraver
private ApplicationContext loadConfig(Clreplaced<?>... configurationClreplacedes) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(configurationClreplacedes);
    context.refresh();
    return context;
}

17 View Complete Implementation : WebSocketMessageBrokerConfigurationSupportTests.java
Copyright MIT License
Author : codeEngraver
private ApplicationContext createConfig(Clreplaced<?>... configClreplacedes) {
    AnnotationConfigApplicationContext config = new AnnotationConfigApplicationContext();
    config.register(configClreplacedes);
    config.refresh();
    return config;
}

17 View Complete Implementation : EnableCachingIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void repositoryUsesAspectJAdviceMode() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced, AspectJCacheConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (Exception ex) {
        // this test is a bit fragile, but gets the job done, proving that an
        // attempt was made to look up the AJ aspect. It's due to clreplacedpath issues
        // in .integration-tests that it's not found.
        replacedertTrue(ex.getMessage().contains("AspectJCachingConfiguration"));
    }
}

17 View Complete Implementation : ScheduledAndTransactionalAnnotationIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void failsWhenJdkProxyAndScheduledMethodNotPresentOnInterface() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced, JdkProxyTxConfig.clreplaced, RepoConfigA.clreplaced);
    try {
        ctx.refresh();
        fail("Should have thrown BeanCreationException");
    } catch (BeanCreationException ex) {
        replacedertTrue(ex.getRootCause() instanceof IllegalStateException);
    }
}

17 View Complete Implementation : KotlinScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

17 View Complete Implementation : JCacheEhCacheAnnotationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ConfigurableApplicationContext getApplicationContext() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getBeanFactory().registerSingleton("cachingProvider", getCachingProvider());
    context.register(EnableCachingConfig.clreplaced);
    context.refresh();
    jCacheManager = context.getBean("jCacheManager", CacheManager.clreplaced);
    return context;
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : Vip-Augus
@Test
public void multipleCachingConfigurers() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiCacheManagerConfigurer.clreplaced, EnableCachingConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (BeanCreationException ex) {
        Throwable root = ex.getRootCause();
        replacedertTrue(root instanceof IllegalStateException);
        replacedertTrue(root.getMessage().contains("implementations of CachingConfigurer"));
    }
}

17 View Complete Implementation : NashornScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl, Clreplaced<?> 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;
}

17 View Complete Implementation : EnableCachingIntegrationTests.java
Copyright MIT License
Author : Vip-Augus
@Test
public void repositoryUsesAspectJAdviceMode() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.clreplaced, AspectJCacheConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (Exception ex) {
        // this test is a bit fragile, but gets the job done, proving that an
        // attempt was made to look up the AJ aspect. It's due to clreplacedpath issues
        // in .integration-tests that it's not found.
        replacedertTrue(ex.getMessage().contains("AspectJCachingConfiguration"));
    }
}

17 View Complete Implementation : RequestMappingDataBindingIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
    wac.register(WebConfig.clreplaced);
    wac.refresh();
    return wac;
}

17 View Complete Implementation : JythonScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : JRubyScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : GroovyMarkupViewTests.java
Copyright MIT License
Author : Vip-Augus
private GroovyMarkupView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(GroovyMarkupConfiguration.clreplaced);
    ctx.refresh();
    GroovyMarkupView view = new GroovyMarkupView();
    view.setUrl(viewUrl);
    view.setApplicationContext(ctx);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : ApplicationContextTests.java
Copyright MIT License
Author : codeEngraver
@Before
public void setUp() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(WebConfig.clreplaced);
    context.refresh();
    this.client = WebTestClient.bindToApplicationContext(context).build();
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void multipleCachingConfigurers() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiCacheManagerConfigurer.clreplaced, EnableCachingConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (BeanCreationException ex) {
        Throwable root = ex.getRootCause();
        replacedertTrue(root instanceof IllegalStateException);
        replacedertTrue(root.getMessage().contains("implementations of CachingConfigurer"));
    }
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void singleCacheManagerBean() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(SingleCacheManagerConfig.clreplaced);
    ctx.refresh();
}

17 View Complete Implementation : Spr9031Tests.java
Copyright MIT License
Author : codeEngraver
/**
 * Direct registration of LowLevelConfig results in reflection-based annotation
 * processing.
 */
@Test
public void withoutAsmAnnotationProcessing() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(LowLevelConfig.clreplaced);
    ctx.refresh();
    replacedertThat(ctx.getBean(LowLevelConfig.clreplaced).scanned, not(nullValue()));
}

17 View Complete Implementation : JacksonHintsIntegrationTests.java
Copyright MIT License
Author : codeEngraver
@Override
protected ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
    wac.register(WebConfig.clreplaced);
    wac.refresh();
    return wac;
}

17 View Complete Implementation : Spr12233Tests.java
Copyright MIT License
Author : codeEngraver
@Test
public void spr12233() throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(PropertySourcesPlaceholderConfigurer.clreplaced);
    ctx.register(ImportConfiguration.clreplaced);
    ctx.refresh();
    ctx.close();
}

17 View Complete Implementation : Spr9031Tests.java
Copyright MIT License
Author : codeEngraver
/**
 * Use of @Import to register LowLevelConfig results in ASM-based annotation
 * processing.
 */
@Test
public void withAsmAnnotationProcessing() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(HighLevelConfig.clreplaced);
    ctx.refresh();
    replacedertThat(ctx.getBean(LowLevelConfig.clreplaced).scanned, not(nullValue()));
}

17 View Complete Implementation : JythonScriptTemplateTests.java
Copyright MIT License
Author : codeEngraver
private ScriptTemplateView createViewWithUrl(String viewUrl) throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ScriptTemplatingConfiguration.clreplaced);
    ctx.refresh();
    ScriptTemplateView view = new ScriptTemplateView();
    view.setApplicationContext(ctx);
    view.setUrl(viewUrl);
    view.afterPropertiesSet();
    return view;
}

17 View Complete Implementation : EnableAsyncTests.java
Copyright MIT License
Author : codeEngraver
/**
 * Fails with clreplacedpath errors on trying to clreplacedload AnnotationAsyncExecutionAspect
 */
@Test(expected = BeanDefinitionStoreException.clreplaced)
public void aspectModeAspectJAttemptsToRegisterAsyncAspect() {
    @SuppressWarnings("resource")
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(AspectJAsyncAnnotationConfig.clreplaced);
    ctx.refresh();
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void multipleCacheManagerBeans() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiCacheManagerConfig.clreplaced);
    try {
        ctx.refresh();
    } catch (IllegalStateException ex) {
        replacedertTrue(ex.getMessage().contains("no unique bean of type CacheManager"));
    }
}

17 View Complete Implementation : EnableCachingTests.java
Copyright MIT License
Author : codeEngraver
@Test
public void multipleCacheManagerBeans_implementsCachingConfigurer() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiCacheManagerConfigurer.clreplaced);
    // does not throw an exception
    ctx.refresh();
}