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

相關文章
相關標籤/搜索