<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" 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://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <!-- 配置Controller扫描 --> <!-- 扫描@Controler @Service 下的包 --> <context:component-scan base-package="com.yrf.web" /> <!-- 处理硬编码加载文件 --> <context:property-placeholder location="classpath:resource.properties" /> <!-- 配置注解驱动 --> <mvc:annotation-driven /> <!-- 对静态资源放行 --> <!-- <mvc:resources location="/css/" mapping="/css/**"/> <mvc:resources location="/js/" mapping="/js/**"/> <mvc:resources location="/fonts/" mapping="/fonts/**"/> --> <!-- 解决静态资源无法被springMVC处理的问题 --> <mvc:default-servlet-handler /> <!-- 配置视图解析器 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!-- 前缀 --> <property name="prefix" value="/WEB-INF/jsp/" /> <!-- 后缀 --> <property name="suffix" value=".jsp" /> </bean> <!-- <mvc:annotation-driven conversion-service="conversionService"></mvc:annotation-driven> 自定义参数绑定 <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> 转换器 <property name="converters"> <list> 日期类型转换 <bean class="com.yrf.utils.CustomDateConverter"/> </list> </property> </bean> --> </beans> |