spring 事务配置与springmvc配置注意事项

spring与springmvc在架构中一块儿使用时,容易碰到一个事务配置失效的问题,今天调了好久才发现, 1:若是springmvc配置controller扫包到单独的controller包时,不须要配置去除service注解,一样service也不须要配置去除controller注解,事务都能生效。 2:若是springmvc配置controller扫包到一个非终点节点包时,须要作以下配置才能使事务生效。 <context:component-scan base-package="net.hunme" > <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" /> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" /> </context:component-scan> <context:component-scan base-package="net.hunme"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan>spring