springboot整合jdbc-配置数据源
-
使用默认的hikariDataSource数据源
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=123456
-
使用第三方druid数据源
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
注意在pom文件中添加druid依赖