1. 程式人生 > >spring boot升級到2.*版本

spring boot升級到2.*版本

DataSourceBuilder

import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;

ompile group: ‘org.springframework.boot’,
name: ‘spring-boot-autoconfigure’,
version: ‘2.0.0.RELEASE’
此版本之後,就是
import org.springframework.boot.jdbc.DataSourceBuilder;

Cause: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.

spring-boot 1.*版本中

spring:
    datasource:
            driver-class-name: com.mysql.jdbc.Driver
            url: jdbc:mysql://localhost:3306/databasename?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&noAccessToProcedureBodies=true
            username: root
            password: 123456
            type: com.alibaba.druid.pool.DruidDataSource
            initialSize: 5
            minIdle: 5
            maxActive: 50
            maxWait: 1000
            filters: stat,wall,log4j

spring boot 2.*版本中

spring:
    datasource:
        driver-class-name: com.mysql.jdbc.Driver
        jdbc-url: jdbc:mysql://localhost:3306/databasename?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&noAccessToProcedureBodies=true
        username: root
        password: 123456
        type: com.alibaba.druid.pool.DruidDataSource
        initialSize: 5
        minIdle: 5
        maxActive: 50
        maxWait: 1000
        filters: stat,wall,log4j