<? 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-4.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--注解处理器映射器 -->
< bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"></ bean >
<!--注解处理器适配器 -->
< bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"></ bean >
<!--使用mvc:annotation-driven可以代替上面的映射器和适配器
这里面会默认加载很多参数绑定方法,比如json转换解析器就默认加载,所以优先使用下面的配置
-->
<!-- <mvc:annotation-driven></mvc:annotation-driven> -->
<!--单个配置Handler -->
<!-- <bean class="com.ys.controller.HelloController"></bean> -->
<!--批量配置Handler,指定扫描的包全称 -->
< context:component-scan base-package="com.ys.controller"></ context:component-scan >
<!--配置视图解析器 -->
< bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 返回视图页面的前缀 -->
< property name="prefix" value="/WEB-INF/view/"></ property >
<!-- 返回页面的后缀 -->
< property name="suffix" value=".jsp"></ property >
</ bean >
</ beans >
|