-
使用springboot默认的连接池
-
导入springboot data-jdbc依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jdbc</artifactId> </dependency>
-
配置文件配置连接池
spring: datasource: username: root password: 5201314 url: jdbc:mysql:///jqmb?serverTimezone=UTC driver-class-name: com.mysql.cj.jdbc.Driver
-
springboot默认的连接池
//java项目www.fhadmin.org @Autowired DataSource dataSource; @Test void contextLoads() { System.out.println(dataSource.getClass()); System.out.println("____________________________________"); }
-
使用连接池druid
-
导入druid依赖<