Spring注解 - TX 声明式事务
环境搭建 导入maven依赖 <!--spring提供的数据库操作工具--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>5.0.2.RELEASE</version> </dependency> <!--c3p0 数据库连接池--> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.5</version> </dependency> <!--mysql连接器--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.48</version> </dependency> 配置数据库相关信息 @Configuration @ComponentScan("com.spring.tx") public class TxConfig { /** * 配置数据源 */ @Bean public DataSource dataSource() throws