SpringBoot 整合Mysql

pom.xml


            org.springframework.boot
            spring-boot-starter-jdbc


            mysql
            mysql-connector-java
            8.0.29
            runtime


            com.alibaba
            druid-spring-boot-starter
            ${druid.version}



application.yml

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/demo?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
    username: root
    password: root
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
  druid:
    filters: stat,log4j2
    initial-size: 1
    min-idle: 1
    max-active: 20
    max-wait: 60000
    time-between-eviction-runs-millis: 60000
    min-evictable-idle-time-millis: 300000
    validation-query: SELECT 1
    test-while-idle: true
    test-on-borrow: false
    test-on-return: false
    query-timeout: 30
  servlet:
    multipart:
      enabled: true
      max-file-size: 5MB
      max-request-size: 10MB

你可能感兴趣的:(SpringBoot 整合Mysql)