dynamic-datasource-spring-boot-starter V1.1.0 released

  

SpringBoot2.x uses HikariCP by default, but the users of Druid in China are very large. This project has specially adapted it to complete monitoring using Druid under multiple data sources.

  1. The project introduces druid-spring-boot-starter dependency.

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid-spring-boot-starter</artifactId>
    <version>1.1.9</version>
</dependency>
  1. A quick configuration class that excludes native Druid.

@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
public class Application {


  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }


}

Why exclude?

DruidDataSourceAutoConfigure will inject a DataSourceWrapper before DynamciDataSourceAutoConfiguration, and will find url, username, password, etc. under the native spring.datasource. And the configuration path of our dynamic data source is changed.

  1. Other properties are still the same as the configuration of the native druid-spring-boot-starter.

spring:
  datasource:
    druid:
      stat-view-servlet:
        loginUsername: admin
        loginPassword: 123456

The access user and password can be configured as above.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325346463&siteId=291194637