mvc:interceptors namespace element initial commit

This commit is contained in:
Keith Donald
2009-11-21 15:17:26 +00:00
parent 602118f1a3
commit 44fcc572a7
3 changed files with 48 additions and 6 deletions

View File

@@ -130,6 +130,19 @@ public class MvcNamespaceTests {
assertTrue(container.getBean(TestValidator.class).validatorInvoked);
assertFalse(handler.recordedValidationError);
}
@Test
public void testInterceptors() throws Exception {
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(container);
reader.loadBeanDefinitions(new ClassPathResource("mvc-config-interceptors.xml", getClass()));
assertEquals(4, container.getBeanDefinitionCount());
DefaultAnnotationHandlerMapping mapping = container.getBean(DefaultAnnotationHandlerMapping.class);
assertNotNull(mapping);
assertEquals(0, mapping.getOrder());
AnnotationMethodHandlerAdapter adapter = container.getBean(AnnotationMethodHandlerAdapter.class);
assertNotNull(adapter);
assertNotNull(container.getBean(FormattingConversionServiceFactoryBean.class));
}
@Controller
public static class TestController {

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:annotation-driven>
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
<bean class="org.springframework.web.servlet.i18n.ThemeChangeInterceptor" />
</mvc:interceptors>
</mvc:annotation-driven>
</beans>