37 lines
1.8 KiB
XML
37 lines
1.8 KiB
XML
<?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"
|
||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||
http://www.springframework.org/schema/mvc
|
||
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||
http://www.springframework.org/schema/context
|
||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||
|
||
<!-- 配置SpringMVC -->
|
||
<!-- 1.开启SpringMVC注解模式 -->
|
||
<!-- 简化配置:
|
||
(1)自动注册DefaultAnootationHandlerMapping,AnotationMethodHandlerAdapter
|
||
(2)提供一些列:数据绑定,数字和日期的format @NumberFormat, @DateTimeFormat, xml,json默认读写支持
|
||
-->
|
||
<mvc:annotation-driven />
|
||
<!-- 2.静态资源默认servlet配置
|
||
(1)加入对静态资源的处理:js,gif,png
|
||
(2)允许使用"/"做整体映射
|
||
-->
|
||
<mvc:default-servlet-handler/>
|
||
|
||
<!-- 3.配置jsp 显示ViewResolver -->
|
||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
|
||
<property name="prefix" value="/WEB-INF/jsp/" />
|
||
<property name="suffix" value=".jsp" />
|
||
</bean>
|
||
|
||
<!-- 4.扫描web相关的bean -->
|
||
<context:component-scan base-package="com.oldpeoplehome.web" />
|
||
<context:component-scan base-package="com.oldpeoplehome">
|
||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||
</context:component-scan>
|
||
</beans> |