Here are the examples of the java api org.springframework.context.annotation.AnnotationConfigApplicationContext taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
155 Examples
19
View Complete Implementation : WebHttpHandlerBuilderTests.java
Copyright MIT License
Author : Vip-Augus
Copyright MIT License
Author : Vip-Augus
// SPR-15074
@Test
public void orderedWebFilterBeans() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(OrderedWebFilterBeanConfig.clreplaced);
context.refresh();
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
replacedertTrue(httpHandler instanceof HttpWebHandlerAdapter);
replacedertSame(context, ((HttpWebHandlerAdapter) httpHandler).getApplicationContext());
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
MockServerHttpResponse response = new MockServerHttpResponse();
httpHandler.handle(request, response).block(ofMillis(5000));
replacedertEquals("FilterB::FilterA", response.getBodyreplacedtring().block(ofMillis(5000)));
}
19
View Complete Implementation : JythonScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : RequestMappingIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Override
protected ApplicationContext initApplicationContext() {
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
wac.register(WebConfig.clreplaced, TestRestController.clreplaced, LocalConfig.clreplaced);
wac.refresh();
return wac;
}
19
View Complete Implementation : AutowiredConfigurationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testValueInjectionWithAliasedMetaAnnotation() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValueConfigWithAliasedMetaAnnotation.clreplaced);
doTestValueInjection(context);
}
19
View Complete Implementation : WebSocketMessageBrokerConfigurationSupportTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
private ApplicationContext createConfig(Clreplaced<?>... configClreplacedes) {
AnnotationConfigApplicationContext config = new AnnotationConfigApplicationContext();
config.register(configClreplacedes);
config.refresh();
return config;
}
19
View Complete Implementation : RequestMappingViewResolutionIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Override
protected ApplicationContext initApplicationContext() {
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
wac.register(WebConfig.clreplaced);
wac.refresh();
return wac;
}
19
View Complete Implementation : NashornScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void resolveExceptionWithreplacedertionError() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
replacedertionError err = new replacedertionError("argh");
HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle");
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, new NestedServletException("Handler dispatch failed", err));
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo(err.toString());
}
19
View Complete Implementation : WebFluxConfigurationSupportTests.java
Copyright MIT License
Author : Vip-Augus
Copyright MIT License
Author : Vip-Augus
private ApplicationContext loadConfig(Clreplaced<?>... configurationClreplacedes) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(configurationClreplacedes);
context.refresh();
return context;
}
19
View Complete Implementation : JRubyScriptTemplateTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : MethodValidationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
@SuppressWarnings("resource")
public void testLazyValidatorForMethodValidationWithProxyTargetClreplaced() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(LazyMethodValidationConfigWithProxyTargetClreplaced.clreplaced, CustomValidatorBean.clreplaced, MyValidBean.clreplaced, MyValidFactoryBean.clreplaced);
ctx.getBeansOfType(MyValidInterface.clreplaced).values().forEach(bean -> bean.myValidMethod("value", 5));
}
19
View Complete Implementation : MethodValidationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
@SuppressWarnings("resource")
public void testLazyValidatorForMethodValidation() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(LazyMethodValidationConfig.clreplaced, CustomValidatorBean.clreplaced, MyValidBean.clreplaced, MyValidFactoryBean.clreplaced);
ctx.getBeansOfType(MyValidInterface.clreplaced).values().forEach(bean -> bean.myValidMethod("value", 5));
}
19
View Complete Implementation : RequestMappingMessageConversionIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Override
protected ApplicationContext initApplicationContext() {
AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
wac.register(WebConfig.clreplaced);
wac.refresh();
return wac;
}
19
View Complete Implementation : EnableTransactionManagementIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
void repositoryIsTxProxy_withDefaultTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.clreplaced, DefaultTxManagerNameConfig.clreplaced);
replacedertTxProxying(ctx);
}
19
View Complete Implementation : GroovyMarkupViewTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : KotlinScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : EnableTransactionManagementIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
void repositoryUsesAspectJAdviceMode() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.clreplaced, AspectJTxConfig.clreplaced);
// 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.
replacedertThatExceptionOfType(Exception.clreplaced).isThrownBy(ctx::refresh).withMessageContaining("AspectJJtaTransactionManagementConfiguration");
}
19
View Complete Implementation : AbstractReactiveWebInitializer.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void resolveExceptionControllerAdviceNoHandler() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyControllerAdviceConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
IllegalStateException ex = new IllegalStateException();
ModelAndView mav = this.resolver.resolveException(this.request, this.response, null, ex);
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("DefaultTestExceptionResolver: IllegalStateException");
}
19
View Complete Implementation : DelegatingWebFluxConfigurationIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
/**
* Integration tests for {@link DelegatingWebFluxConfiguration}.
*
* @author Stephane Nicoll
*/
public clreplaced DelegatingWebFluxConfigurationIntegrationTests {
private AnnotationConfigApplicationContext context;
@AfterEach
public void closeContext() {
if (this.context != null) {
this.context.close();
}
}
@Test
void requestMappingHandlerMappingUsesWebFluxInfrastructureByDefault() {
load(context -> {
});
RequestMappingHandlerMapping handlerMapping = this.context.getBean(RequestMappingHandlerMapping.clreplaced);
replacedertThat(handlerMapping.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
}
@Test
void requestMappingHandlerMappingWithPrimaryUsesQualifiedRequestedContentTypeResolver() {
load(registerPrimaryBean("testContentTypeResolver", RequestedContentTypeResolver.clreplaced));
RequestMappingHandlerMapping handlerMapping = this.context.getBean(RequestMappingHandlerMapping.clreplaced);
replacedertThat(handlerMapping.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
replacedertThat(this.context.getBeansOfType(RequestedContentTypeResolver.clreplaced)).containsOnlyKeys("webFluxContentTypeResolver", "testContentTypeResolver");
}
@Test
void requestMappingHandlerAdapterUsesWebFluxInfrastructureByDefault() {
load(context -> {
});
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.clreplaced);
replacedertThat(mappingHandlerAdapter.getReactiveAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(mappingHandlerAdapter.getWebBindingInitializer()).hasFieldOrPropertyWithValue("conversionService", this.context.getBean("webFluxConversionService"));
replacedertThat(mappingHandlerAdapter.getWebBindingInitializer()).hasFieldOrPropertyWithValue("validator", this.context.getBean("webFluxValidator"));
}
@Test
void requestMappingHandlerAdapterWithPrimaryUsesQualifiedReactiveAdapterRegistry() {
load(registerPrimaryBean("testReactiveAdapterRegistry", ReactiveAdapterRegistry.clreplaced));
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.clreplaced);
replacedertThat(mappingHandlerAdapter.getReactiveAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(this.context.getBeansOfType(ReactiveAdapterRegistry.clreplaced)).containsOnlyKeys("webFluxAdapterRegistry", "testReactiveAdapterRegistry");
}
@Test
void requestMappingHandlerAdapterWithPrimaryUsesQualifiedConversionService() {
load(registerPrimaryBean("testConversionService", FormattingConversionService.clreplaced));
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.clreplaced);
replacedertThat(mappingHandlerAdapter.getWebBindingInitializer()).hasFieldOrPropertyWithValue("conversionService", this.context.getBean("webFluxConversionService"));
replacedertThat(this.context.getBeansOfType(FormattingConversionService.clreplaced)).containsOnlyKeys("webFluxConversionService", "testConversionService");
}
@Test
void requestMappingHandlerAdapterWithPrimaryUsesQualifiedValidator() {
load(registerPrimaryBean("testValidator", Validator.clreplaced));
RequestMappingHandlerAdapter mappingHandlerAdapter = this.context.getBean(RequestMappingHandlerAdapter.clreplaced);
replacedertThat(mappingHandlerAdapter.getWebBindingInitializer()).hasFieldOrPropertyWithValue("validator", this.context.getBean("webFluxValidator"));
replacedertThat(this.context.getBeansOfType(Validator.clreplaced)).containsOnlyKeys("webFluxValidator", "testValidator");
}
@Test
void responseEnreplacedyResultHandlerUsesWebFluxInfrastructureByDefault() {
load(context -> {
});
ResponseEnreplacedyResultHandler responseEnreplacedyResultHandler = this.context.getBean(ResponseEnreplacedyResultHandler.clreplaced);
replacedertThat(responseEnreplacedyResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(responseEnreplacedyResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
}
@Test
void responseEnreplacedyResultHandlerWithPrimaryUsesQualifiedReactiveAdapterRegistry() {
load(registerPrimaryBean("testReactiveAdapterRegistry", ReactiveAdapterRegistry.clreplaced));
ResponseEnreplacedyResultHandler responseEnreplacedyResultHandler = this.context.getBean(ResponseEnreplacedyResultHandler.clreplaced);
replacedertThat(responseEnreplacedyResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(this.context.getBeansOfType(ReactiveAdapterRegistry.clreplaced)).containsOnlyKeys("webFluxAdapterRegistry", "testReactiveAdapterRegistry");
}
@Test
void responseEnreplacedyResultHandlerWithPrimaryUsesQualifiedRequestedContentTypeResolver() {
load(registerPrimaryBean("testContentTypeResolver", RequestedContentTypeResolver.clreplaced));
ResponseEnreplacedyResultHandler responseEnreplacedyResultHandler = this.context.getBean(ResponseEnreplacedyResultHandler.clreplaced);
replacedertThat(responseEnreplacedyResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
replacedertThat(this.context.getBeansOfType(RequestedContentTypeResolver.clreplaced)).containsOnlyKeys("webFluxContentTypeResolver", "testContentTypeResolver");
}
@Test
void responseBodyResultHandlerUsesWebFluxInfrastructureByDefault() {
load(context -> {
});
ResponseBodyResultHandler responseBodyResultHandler = this.context.getBean(ResponseBodyResultHandler.clreplaced);
replacedertThat(responseBodyResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(responseBodyResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
}
@Test
void responseBodyResultHandlerWithPrimaryUsesQualifiedReactiveAdapterRegistry() {
load(registerPrimaryBean("testReactiveAdapterRegistry", ReactiveAdapterRegistry.clreplaced));
ResponseBodyResultHandler responseBodyResultHandler = this.context.getBean(ResponseBodyResultHandler.clreplaced);
replacedertThat(responseBodyResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(this.context.getBeansOfType(ReactiveAdapterRegistry.clreplaced)).containsOnlyKeys("webFluxAdapterRegistry", "testReactiveAdapterRegistry");
}
@Test
void responseBodyResultHandlerWithPrimaryUsesQualifiedRequestedContentTypeResolver() {
load(registerPrimaryBean("testContentTypeResolver", RequestedContentTypeResolver.clreplaced));
ResponseBodyResultHandler responseBodyResultHandler = this.context.getBean(ResponseBodyResultHandler.clreplaced);
replacedertThat(responseBodyResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
replacedertThat(this.context.getBeansOfType(RequestedContentTypeResolver.clreplaced)).containsOnlyKeys("webFluxContentTypeResolver", "testContentTypeResolver");
}
@Test
void viewResolutionResultHandlerUsesWebFluxInfrastructureByDefault() {
load(context -> {
});
ViewResolutionResultHandler viewResolutionResultHandler = this.context.getBean(ViewResolutionResultHandler.clreplaced);
replacedertThat(viewResolutionResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(viewResolutionResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
}
@Test
void viewResolutionResultHandlerWithPrimaryUsesQualifiedReactiveAdapterRegistry() {
load(registerPrimaryBean("testReactiveAdapterRegistry", ReactiveAdapterRegistry.clreplaced));
ViewResolutionResultHandler viewResolutionResultHandler = this.context.getBean(ViewResolutionResultHandler.clreplaced);
replacedertThat(viewResolutionResultHandler.getAdapterRegistry()).isSameAs(this.context.getBean("webFluxAdapterRegistry"));
replacedertThat(this.context.getBeansOfType(ReactiveAdapterRegistry.clreplaced)).containsOnlyKeys("webFluxAdapterRegistry", "testReactiveAdapterRegistry");
}
@Test
void viewResolutionResultHandlerWithPrimaryUsesQualifiedRequestedContentTypeResolver() {
load(registerPrimaryBean("testContentTypeResolver", RequestedContentTypeResolver.clreplaced));
ViewResolutionResultHandler viewResolutionResultHandler = this.context.getBean(ViewResolutionResultHandler.clreplaced);
replacedertThat(viewResolutionResultHandler.getContentTypeResolver()).isSameAs(this.context.getBean("webFluxContentTypeResolver"));
replacedertThat(this.context.getBeansOfType(RequestedContentTypeResolver.clreplaced)).containsOnlyKeys("webFluxContentTypeResolver", "testContentTypeResolver");
}
private <T> Consumer<AnnotationConfigApplicationContext> registerPrimaryBean(String beanName, Clreplaced<T> type) {
return context -> context.registerBean(beanName, type, () -> mock(type), definition -> definition.setPrimary(true));
}
private void load(Consumer<AnnotationConfigApplicationContext> context) {
AnnotationConfigApplicationContext testContext = new AnnotationConfigApplicationContext();
context.accept(testContext);
testContext.registerBean(DelegatingWebFluxConfiguration.clreplaced);
testContext.refresh();
this.context = testContext;
}
}
19
View Complete Implementation : AutowiredConfigurationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testValueInjectionWithProviderConstructorArguments() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValueConfigWithProviderConstructorArguments.clreplaced);
doTestValueInjection(context);
}
19
View Complete Implementation : AutowiredConfigurationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testValueInjectionWithMetaAnnotation() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValueConfigWithMetaAnnotation.clreplaced);
doTestValueInjection(context);
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void resolveExceptionGlobalHandler() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
IllegalAccessException ex = new IllegalAccessException();
HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle");
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex);
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("AnotherTestExceptionResolver: IllegalAccessException");
}
19
View Complete Implementation : WebFluxConfigurationSupportTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
private ApplicationContext loadConfig(Clreplaced<?>... configurationClreplacedes) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(configurationClreplacedes);
context.refresh();
return context;
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void resolveExceptionGlobalHandlerOrdered() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
IllegalStateException ex = new IllegalStateException();
HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle");
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex);
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("TestExceptionResolver: IllegalStateException");
}
19
View Complete Implementation : AutowiredConfigurationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testValueInjectionWithProviderFields() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValueConfigWithProviderFields.clreplaced);
doTestValueInjection(context);
}
19
View Complete Implementation : AnnotationDrivenEventListenerTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
private void doLoad(Clreplaced<?>... clreplacedes) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(clreplacedes);
this.eventCollector = ctx.getBean(EventCollector.clreplaced);
this.countDownLatch = ctx.getBean(CountDownLatch.clreplaced);
this.context = ctx;
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
// SPR-16496
@Test
public void resolveExceptionControllerAdviceAgainstProxy() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyControllerAdviceConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
IllegalStateException ex = new IllegalStateException();
HandlerMethod handlerMethod = new HandlerMethod(new ProxyFactory(new ResponseBodyController()).getProxy(), "handle");
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex);
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("BasePackageTestExceptionResolver: IllegalStateException");
}
19
View Complete Implementation : MethodValidationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testLazyValidatorForMethodValidationWithProxyTargetClreplaced() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(LazyMethodValidationConfigWithProxyTargetClreplaced.clreplaced, CustomValidatorBean.clreplaced, MyValidBean.clreplaced, MyValidFactoryBean.clreplaced);
ctx.getBeansOfType(MyValidInterface.clreplaced).values().forEach(bean -> bean.myValidMethod("value", 5));
}
19
View Complete Implementation : KotlinScriptTemplateTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : EnableAsyncTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void properExceptionForResolvedProxyDependencyMismatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(AsyncConfig.clreplaced, AsyncBereplaceder.clreplaced, AsyncBeanWithInterface.clreplaced);
replacedertThatExceptionOfType(UnsatisfiedDependencyException.clreplaced).isThrownBy(ctx::refresh).withCauseInstanceOf(BeanNotOfRequiredTypeException.clreplaced);
ctx.close();
}
19
View Complete Implementation : WebHttpHandlerBuilderTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void forwardedHeaderFilter() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(ForwardedHeaderFilterConfig.clreplaced);
context.refresh();
WebHttpHandlerBuilder builder = WebHttpHandlerBuilder.applicationContext(context);
builder.filters(filters -> replacedertThat(filters).isEqualTo(Collections.emptyList()));
replacedertThat(builder.hasForwardedHeaderTransformer()).isTrue();
}
19
View Complete Implementation : ImportWithConditionTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
/**
* @author Andy Wilkinson
*/
public clreplaced ImportWithConditionTests {
private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@Test
public void conditionalThenUnconditional() throws Exception {
this.context.register(ConditionalThenUnconditional.clreplaced);
this.context.refresh();
replacedertThat(this.context.containsBean("beanTwo")).isFalse();
replacedertThat(this.context.containsBean("beanOne")).isTrue();
}
@Test
public void unconditionalThenConditional() throws Exception {
this.context.register(UnconditionalThenConditional.clreplaced);
this.context.refresh();
replacedertThat(this.context.containsBean("beanTwo")).isFalse();
replacedertThat(this.context.containsBean("beanOne")).isTrue();
}
@Configuration
@Import({ ConditionalConfiguration.clreplaced, UnconditionalConfiguration.clreplaced })
protected static clreplaced ConditionalThenUnconditional {
@Autowired
private BeanOne beanOne;
}
@Configuration
@Import({ UnconditionalConfiguration.clreplaced, ConditionalConfiguration.clreplaced })
protected static clreplaced UnconditionalThenConditional {
@Autowired
private BeanOne beanOne;
}
@Configuration
@Import(BeanProvidingConfiguration.clreplaced)
protected static clreplaced UnconditionalConfiguration {
}
@Configuration
@Conditional(NeverMatchingCondition.clreplaced)
@Import(BeanProvidingConfiguration.clreplaced)
protected static clreplaced ConditionalConfiguration {
}
@Configuration
protected static clreplaced BeanProvidingConfiguration {
@Bean
BeanOne beanOne() {
return new BeanOne();
}
}
private static final clreplaced BeanOne {
}
private static final clreplaced NeverMatchingCondition implements ConfigurationCondition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
return false;
}
@Override
public ConfigurationPhase getConfigurationPhase() {
return ConfigurationPhase.REGISTER_BEAN;
}
}
}
19
View Complete Implementation : NashornScriptTemplateTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : EnableAsyncTests.java
Copyright MIT License
Author : Vip-Augus
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();
}
19
View Complete Implementation : EnableTransactionManagementIntegrationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
void repositoryIsTxProxy_withCustomTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.clreplaced, CustomTxManagerNameConfig.clreplaced);
replacedertTxProxying(ctx);
}
19
View Complete Implementation : WebHttpHandlerBuilderTests.java
Copyright MIT License
Author : Vip-Augus
Copyright MIT License
Author : Vip-Augus
// SPR-15074
@Test
public void orderedWebExceptionHandlerBeans() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(OrderedExceptionHandlerBeanConfig.clreplaced);
context.refresh();
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
MockServerHttpResponse response = new MockServerHttpResponse();
httpHandler.handle(request, response).block(ofMillis(5000));
replacedertEquals("ExceptionHandlerB", response.getBodyreplacedtring().block(ofMillis(5000)));
}
19
View Complete Implementation : ImportTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
// ------------------------------------------------------------------------
/**
* Test that values supplied to @Configuration(value="...") are propagated as the
* bean name for the configuration clreplaced even in the case of inclusion via @Import
* or in the case of automatic registration via nesting
*/
@Test
public void reproSpr9023() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(B.clreplaced);
ctx.refresh();
System.out.println(ctx.getBeanFactory());
replacedertThat(ctx.getBeanNamesForType(B.clreplaced)[0]).isEqualTo("config-b");
replacedertThat(ctx.getBeanNamesForType(A.clreplaced)[0]).isEqualTo("config-a");
}
19
View Complete Implementation : JRubyScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : AutowiredConfigurationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testValueInjectionWithProviderMethodArguments() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValueConfigWithProviderMethodArguments.clreplaced);
doTestValueInjection(context);
}
19
View Complete Implementation : KotlinScriptTemplateTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : JythonScriptTemplateTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : GroovyMarkupViewTests.java
Copyright MIT License
Author : Vip-Augus
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;
}
19
View Complete Implementation : MethodValidationTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void testLazyValidatorForMethodValidation() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(LazyMethodValidationConfig.clreplaced, CustomValidatorBean.clreplaced, MyValidBean.clreplaced, MyValidFactoryBean.clreplaced);
ctx.getBeansOfType(MyValidInterface.clreplaced).values().forEach(bean -> bean.myValidMethod("value", 5));
}
19
View Complete Implementation : ExceptionHandlerExceptionResolverTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void resolveExceptionControllerAdviceHandler() throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyControllerAdviceConfig.clreplaced);
this.resolver.setApplicationContext(ctx);
this.resolver.afterPropertiesSet();
IllegalStateException ex = new IllegalStateException();
HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle");
ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex);
replacedertThat(mav).as("Exception was not handled").isNotNull();
replacedertThat(mav.isEmpty()).isTrue();
replacedertThat(this.response.getContentreplacedtring()).isEqualTo("BasePackageTestExceptionResolver: IllegalStateException");
}
19
View Complete Implementation : KotlinScriptTemplateTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
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;
}
19
View Complete Implementation : WebHttpHandlerBuilderTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void configWithoutFilters() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(NoFilterConfig.clreplaced);
context.refresh();
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
MockServerHttpResponse response = new MockServerHttpResponse();
httpHandler.handle(request, response).block(ofMillis(5000));
replacedertThat(response.getBodyreplacedtring().block(ofMillis(5000))).isEqualTo("handled");
}
19
View Complete Implementation : EnableAsyncTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
/**
* Fails with clreplacedpath errors on trying to clreplacedload AnnotationAsyncExecutionAspect.
*/
@Test
public void aspectModeAspectJAttemptsToRegisterAsyncAspect() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(AspectJAsyncAnnotationConfig.clreplaced);
replacedertThatExceptionOfType(BeanDefinitionStoreException.clreplaced).isThrownBy(ctx::refresh);
}
19
View Complete Implementation : AbstractReactiveWebInitializer.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
/**
* 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;
}
19
View Complete Implementation : EnableAsyncTests.java
Copyright Apache License 2.0
Author : spring-projects
Copyright Apache License 2.0
Author : spring-projects
@Test
public void properExceptionForExistingProxyDependencyMismatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(AsyncConfig.clreplaced, AsyncBeanWithInterface.clreplaced, AsyncBereplaceder.clreplaced);
replacedertThatExceptionOfType(UnsatisfiedDependencyException.clreplaced).isThrownBy(ctx::refresh).withCauseInstanceOf(BeanNotOfRequiredTypeException.clreplaced);
ctx.close();
}