标签:cti The har jdbc cto uid 引入 === color
<!--加入mybatis依赖--> <!--引入satrter--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.2</version> </dependency> <!--mysql的jdbc驱动--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!--引入第三方数据源--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.8</version> </dependency>
#===============================数据库相关====================================== #数据库驱动(可以自动识别) #spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/databaseName?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=username spring.datasource.password=password #修改数据源(com.zaxxer.hikari.HikariDataSource) spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
useUnicode=true&characterEncoding=UTF-8:防止中文乱码
serverTimezone=UTC:设置时间,UTC是世界标准时间
未设置时间报数据库连接错误:The server time zone value ‘?й???????‘ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration
@MapperScan("mapper包路径")
SpringBoot整合Mybatis访问数据库和阿里巴巴数据源
标签:cti The har jdbc cto uid 引入 === color
原文地址:https://www.cnblogs.com/jwmdlm/p/12591854.html