解决 shardingjdbc 健康监测与spring 2.3.1 及以上版本不兼容问题
This commit is contained in:
@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<project
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>com.chinaunicom.ebtp</groupId>
|
|
||||||
<artifactId>mall-ebtp-cloud-attachment-sdk</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.chinaunicom.ebtp</groupId>
|
|
||||||
<artifactId>mall-ebtp-cloud-parent</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
<relativePath>../mall-ebtp-cloud-parent</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.chinaunicom.ebtp</groupId>
|
|
||||||
<artifactId>mall-ebtp-cloud-mvc-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>nexus-aliyun</id>
|
|
||||||
<name>Nexus aliyun</name>
|
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>ettp-host-release</id>
|
|
||||||
<name>Install to ettp center</name>
|
|
||||||
<url>http://zentao.jlcucc.com:60000/repository/ettp-releases/</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
</project>
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
# AutoConfiguration
|
|
||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|
||||||
com.chinaunicom.ebtp.mall.cloud.attachment.sdk.config.SDKAutoConfiguration
|
|
@ -1,2 +0,0 @@
|
|||||||
ribbon.ReadTimeout=1800000
|
|
||||||
ribbon.SocketTimeout=1800000
|
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.core.config;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration;
|
||||||
|
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||||
|
import org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator;
|
||||||
|
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadataProvider;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决 shardingjdbc 在 spring 2.3.1 及以上版本中健康监测异常问题 #6002
|
||||||
|
*
|
||||||
|
* @author Ajaxfan
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class EBTPDataSourceHealthContributorAutoConfiguration extends DataSourceHealthContributorAutoConfiguration {
|
||||||
|
|
||||||
|
public EBTPDataSourceHealthContributorAutoConfiguration(Map<String, DataSource> dataSources,
|
||||||
|
ObjectProvider<DataSourcePoolMetadataProvider> metadataProviders) {
|
||||||
|
super(dataSources, metadataProviders);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param source
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected AbstractHealthIndicator createIndicator(DataSource source) {
|
||||||
|
return new DataSourceHealthIndicator(source, "select 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user