1234567891011121314151617181920212223242526272829303132333435 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
-
- <context:annotation-config />
- <!-- 把标记了@Controller注解的类转换为bean -->
- <context:component-scan base-package="com.jsjty" use-default-filters="false">
- <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
- </context:component-scan>
- <mvc:annotation-driven conversion-service="conversionService"/>
-
- <bean id="conversionService"
- class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
- <property name="formatters">
- <set>
- <bean class="com.jsjty.common.DateFormatter"></bean>
- </set>
- </property>
- </bean>
-
- <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
- <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
-
- <bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
- <bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"/>
- <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
- <property name="prefix" value="/WEB-INF/view/jsp/" />
- <property name="suffix" value=".jsp" />
- </bean>
- </beans>
|