<!-- 自動掃描的包名 -->
<context:component-scan base-package="com.app,com.core,JUnit4" ></context:component-scan>
<!-- 默認的註解映射的支持 -->
<mvc:annotation-driven />
<!-- 視圖解釋類 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/><!--可爲空,方便實現自已的依據擴展名來選擇視圖解釋類的邏輯 -->
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
</bean>
<!-- 攔截器 -->
<mvc:interceptors>
<bean class="com.core.mvc.MyInteceptor" />
</mvc:interceptors>
<!-- 對靜態資源文件的訪問 方案一 (二選一) -->
<mvc:default-servlet-handler/>
<!-- 對靜態資源文件的訪問 方案二 (二選一)-->
<mvc:resources mapping="/images/**" location="/images/" cache-period="31556926"/>
<mvc:resources mapping="/js/**" location="/js/" cache-period="31556926"/> css
<mvc:resources mapping="/css/**" location="/css/" cache-period="31556926"/> web
===================================================================spring
加<mvc:resources...前,要加上<mvc:annotation-driver/>,不然servlet控件器會解析失敗mvc