use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class WebMvcConfigurationSupportTests method emptyViewControllerHandlerMapping.
@Test
public void emptyViewControllerHandlerMapping() {
ApplicationContext context = initContext(WebConfig.class);
String name = "viewControllerHandlerMapping";
AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
assertNotNull(handlerMapping);
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
}
use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class WebMvcConfigurationSupportTests method uriComponentsContributor.
@Test
public void uriComponentsContributor() throws Exception {
ApplicationContext context = initContext(WebConfig.class);
CompositeUriComponentsContributor uriComponentsContributor = context.getBean(MvcUriComponentsBuilder.MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME, CompositeUriComponentsContributor.class);
assertNotNull(uriComponentsContributor);
}
use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class WebMvcConfigurationSupportTests method emptyDefaultServletHandlerMapping.
@Test
public void emptyDefaultServletHandlerMapping() {
ApplicationContext context = initContext(WebConfig.class);
String name = "defaultServletHandlerMapping";
AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
assertNotNull(handlerMapping);
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
}
use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class WebMvcConfigurationSupportTests method mvcViewResolver.
@Test
public void mvcViewResolver() {
ApplicationContext context = initContext(WebConfig.class);
ViewResolverComposite resolver = context.getBean("mvcViewResolver", ViewResolverComposite.class);
assertNotNull(resolver);
assertEquals(1, resolver.getViewResolvers().size());
assertEquals(InternalResourceViewResolver.class, resolver.getViewResolvers().get(0).getClass());
assertEquals(Ordered.LOWEST_PRECEDENCE, resolver.getOrder());
}
use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class WebMvcConfigurationSupportTests method customArgumentResolvers.
@Test
public void customArgumentResolvers() {
ApplicationContext context = initContext(CustomArgumentResolverConfig.class);
RequestMappingHandlerAdapter adapter = context.getBean(RequestMappingHandlerAdapter.class);
HandlerExceptionResolverComposite composite = context.getBean(HandlerExceptionResolverComposite.class);
assertNotNull(adapter);
assertEquals(1, adapter.getCustomArgumentResolvers().size());
assertEquals(TestArgumentResolver.class, adapter.getCustomArgumentResolvers().get(0).getClass());
assertEquals(1, adapter.getCustomReturnValueHandlers().size());
assertEquals(TestReturnValueHandler.class, adapter.getCustomReturnValueHandlers().get(0).getClass());
assertNotNull(composite);
assertEquals(3, composite.getExceptionResolvers().size());
assertEquals(ExceptionHandlerExceptionResolver.class, composite.getExceptionResolvers().get(0).getClass());
ExceptionHandlerExceptionResolver resolver = (ExceptionHandlerExceptionResolver) composite.getExceptionResolvers().get(0);
assertEquals(1, resolver.getCustomArgumentResolvers().size());
assertEquals(TestArgumentResolver.class, resolver.getCustomArgumentResolvers().get(0).getClass());
assertEquals(1, resolver.getCustomReturnValueHandlers().size());
assertEquals(TestReturnValueHandler.class, resolver.getCustomReturnValueHandlers().get(0).getClass());
}
Aggregations