@Transactional (transactionmanager= "Maintx", propagation = propagation.required,isolation=isolation.read_committed , Rollbackfor=exception.class)
Specify the transaction manager
Rollback: Default runtimeexception, error rollback, other exception (checked exception) must be declared Rollbackfor,notrollbackfor
Spring-config.xml
<tx:annotation-driven/>
<bean id="transactionmanager"class=" Org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name=" dataSource"ref="maindatasource" /> <qualifier value="maintx"/> </bean>
Spring-mvc.xml Scan Controller only, otherwise it may overwrite transaction declarations of service in context
base-package="com.xxx" use-default-filters="false "> <context:include-filter type="annotation "expression=" org.springframework.stereotype.Controller" /> </context:component-scan>
Spring Transaction Configuration