摘要: 多数据源 1、pom <!-- druid --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.17</version> </d 阅读全文
posted @ 2022-01-15 21:55 得好好活 阅读(3262) 评论(0) 推荐(0)
摘要: 1、pom <!-- jdbcTemplate --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> 2 阅读全文
posted @ 2022-01-15 21:29 得好好活 阅读(317) 评论(0) 推荐(0)
摘要: 一、使用ThreadPoolTaskExecutor创建线程池 这个类则是spring包下的,是sring为我们提供的线程池类 1、线程词配置类 import org.springframework.context.annotation.Bean; import org.springframewor 阅读全文
posted @ 2022-01-15 21:04 得好好活 阅读(3876) 评论(0) 推荐(0)
摘要: 方式一: 1.main方法上加注解 @EnableScheduling 2.写一个执行方法类 import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Compo 阅读全文
posted @ 2022-01-15 20:21 得好好活 阅读(726) 评论(0) 推荐(0)
摘要: 1、pom <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> <version>2.1.6.RELEASE</version> </d 阅读全文
posted @ 2022-01-15 11:44 得好好活 阅读(1113) 评论(0) 推荐(0)
摘要: 1、在启动类上加上注解 @EnableTransactionManagement,即将事务交给spring管理 @EnableTransactionManagement 2、在类上或者方法上加上 @Transactional (rollbackFor = {Exception.class}) @Tr 阅读全文
posted @ 2022-01-15 11:00 得好好活 阅读(646) 评论(0) 推荐(0)