<?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 @service-->
<context:component-scan base-package="包名"/>
<!-- 注解驱动 这个配置自动加载了 处理器映射器 处理器适配器-->
<mvc:annotation-driven>
<!-- 视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置视图解析器的前缀 后缀,便于视图跳转-->
<property name="prefix" value="/WEB-INF/jsp" />
<!-- 此处的.jsp可以是自己起名 只要和视图的名后缀相同就好 -->
<property name="suffix" value=".jsp"/>
</bean>
</beans>