| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
- http://code.alibabatech.com/schema/dubbo
- http://code.alibabatech.com/schema/dubbo/dubbo.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.0.xsd">
- <!--加载静态资源-->
- <mvc:default-servlet-handler/>
- <!--配置@Controller注解扫描-->
- <context:component-scan base-package="com.persagy.controller"></context:component-scan>
- <!--注解驱动:
- 自动配置最新版的注解的处理器映射器和处理器适配器-->
- <mvc:annotation-driven conversion-service="conversionService"></mvc:annotation-driven>
- <!--配置视图解析器:
- 作用:在Controller中指定页面路径的时候就不用写页面的完整路径名和扩展名称了-->
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <!--真正的jsp访问路径是前缀+Controller里的 modelAndView.setViewName()的页面名称+后缀-->
- <!--前缀-->
- <property name="prefix" value="/WEB-INF/jsp/"></property>
- <!--后缀-->
- <property name="suffix" value=".jsp"></property>
- </bean>
- <!-- 配置自定义转换器
- 注意: 一定要将自定义的转换器配置到注解驱动上
- -->
- <bean id="conversionService"
- class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
- <property name="converters">
- <set>
- <!-- 指定自定义转换器的全路径名称 -->
- <bean class="com.persagy.controller.converter.StringToDateConverter"/>
- </set>
- </property>
- </bean>
- <bean id="utf8Charset" class="java.nio.charset.Charset"
- factory-method="forName">
- <constructor-arg value="UTF-8"/>
- </bean>
- <mvc:annotation-driven>
- <mvc:message-converters>
- <bean class="org.springframework.http.converter.StringHttpMessageConverter">
- <constructor-arg ref="utf8Charset"/>
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- </beans>
|