springmvc的配置文件springmvc.xml中加上:
<context:component-scan base-package="com.jiangongbao" use-default-filters="false">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
在spring的配置文件application.xml中加上
<context:component-scan base-package="com.jiangongbao">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
现在直接访问不到controller
如果把springmvc.xml改为
<context:component-scan base-package="com.jangongbao.controller"/>
就能正常访问!
这是为什么呢?????spring整合springmvc 为了避免对象被重复注解不就得这么操作吗,为什么会出问题呢?