<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd "> <!-- 自动扫码的包名 --> <context:component-scan base-package="con.hao947.core"></context:component-scan> <!-- 默认的注解映射的支持 --> <mvc:annotation-driven /> <!-- 视图解释类 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> <!--可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑 --> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property> </bean> <!-- 拦截器 --> <mvc:interceptors> <bean class="com.hao947.mvc"></bean> </mvc:interceptors> <!-- 对静态资源文件的访问 方案一 (二选一) --> <mvc:default-servlet-handler /> <!-- 对静态资源文件的访问 方案二 (二选一) --> <mvc:resources mapping="/images/**" location="/images/" cache-period="" /> <mvc:resources mapping="/js/**" location="/js/" cache-period="" /> <mvc:resources mapping="/css/**" location="/css/" cache-period="" /> </beans>
SpringMVC Service配置文件讲解,布布扣,bubuko.com
原文:http://blog.csdn.net/hao947/article/details/27844905