spring controller configuration
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" 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" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <!-- 使用注解配置 --> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/> <context:component-scan base-package="com.huawei.datavoice"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> <!-- 将Service注解给去掉 --> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/> </context:component-scan> <context:annotation-config /> <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> </mvc:interceptor> </mvc:interceptors> --> <!-- 配置spring mvc 模式 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/"/> <property name="suffix" value=".jsp"/> </bean> <bean id="messageSourse" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" p:basename="i18n/messages"> </bean> </beans>