<context:component-scan base-package="com"> <context:exclude-filter type="annotation" experession="org.springframework.stereotype.Controller" /> </context:component-scan>
2.在SpringMVC配置文件中将Service注解给去掉
<context:component-scan base-package="com"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" /> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" /> </context:component-scan>