基于mybatis-plus的单数据应用。

1.引入依赖

  1. <dependency>
  2. <groupId>com.xy</groupId>
  3. <artifactId>xy-core-framework-dal-standalone-monitor</artifactId>
  4. <version>${xy-core-framework-dal-standalone.version}</version>
  5. </dependency>

2.添加配置

  1. spring.datasource.url=jdbc:mysql://localhost:3306/company-demo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
  2. #spring.datasource.url=jdbc:postgresql://localhost:5432/company-demo?stringtype=unspecified
  3. spring.datasource.type=com.zaxxer.hikari.HikariDataSource
  4. spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  5. #spring.datasource.driver-class-name=org.postgresql.Driver
  6. spring.datasource.username=root
  7. #### 1q2w3e4r@
  8. spring.datasource.password=1q2w3e4r@
  9. spring.datasource.hikari.maximum-pool-size=10
  10. spring.datasource.hikari.minimum-idle=3
  11. spring.datasource.hikari.idle-timeout=600000
  12. spring.datasource.hikari.connection-timeout=30000
  13. spring.datasource.hikari.max-lifetime=28740000
  14. spring.datasource.hikari.connection-test-query=SELECT 1
  15. spring.datasource.hikari.allow-pool-suspension=false
  16. spring.datasource.hikari.auto-commit=true
  17. spring.datasource.hikari.connection-init-sql=SET NAMES utf8mb4

3.编码使用

正常编码就行,事务就是spring的原生事务