1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

sync to edgware before graduation

This commit is contained in:
fangjian0423 2019-07-28 19:42:32 +08:00
parent f19c83a7a9
commit e0c0a9f1c3
21 changed files with 252 additions and 151 deletions

View File

@ -1,6 +1,6 @@
# Spring Cloud Alibaba # Spring Cloud Alibaba
[![CircleCI](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master.svg?style=svg)](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master) [![CircleCI](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master.svg?style=svg)](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master)
[![Maven Central](https://img.shields.io/maven-central/v/org.springframework.cloud/spring-cloud-alibaba-dependencies.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies) [![Maven Central](https://img.shields.io/maven-central/v/org.springframework.cloud/spring-cloud-alibaba-dependencies.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies)
[![Codecov](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba/branch/master/graph/badge.svg)](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba) [![Codecov](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba/branch/master/graph/badge.svg)](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

View File

@ -1,6 +1,6 @@
# Spring Cloud Alibaba # Spring Cloud Alibaba
[![CircleCI](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master.svg?style=svg)](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master) [![CircleCI](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master.svg?style=svg)](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master)
[![Maven Central](https://img.shields.io/maven-central/v/org.springframework.cloud/spring-cloud-alibaba-dependencies.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies) [![Maven Central](https://img.shields.io/maven-central/v/org.springframework.cloud/spring-cloud-alibaba-dependencies.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies)
[![Codecov](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba/branch/master/graph/badge.svg)](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba) [![Codecov](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba/branch/master/graph/badge.svg)](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

View File

@ -19,7 +19,7 @@
<properties> <properties>
<sentinel.version>1.6.2</sentinel.version> <sentinel.version>1.6.2</sentinel.version>
<oss.version>3.1.0</oss.version> <oss.version>3.1.0</oss.version>
<seata.version>0.5.1</seata.version> <seata.version>0.7.1</seata.version>
<nacos.version>1.1.1</nacos.version> <nacos.version>1.1.1</nacos.version>
<acm.version>1.0.9</acm.version> <acm.version>1.0.9</acm.version>
<ans.version>1.0.1</ans.version> <ans.version>1.0.1</ans.version>
@ -193,7 +193,7 @@
<!--Alibaba Seata--> <!--Alibaba Seata-->
<dependency> <dependency>
<groupId>io.seata</groupId> <groupId>io.seata</groupId>
<artifactId>seata-spring</artifactId> <artifactId>seata-all</artifactId>
<version>${seata.version}</version> <version>${seata.version}</version>
</dependency> </dependency>

View File

@ -3,3 +3,4 @@ spring.application.name=acm-local
server.port=18089 server.port=18089
spring.cloud.alicloud.acm.server-list=127.0.0.1 spring.cloud.alicloud.acm.server-list=127.0.0.1
spring.cloud.alicloud.acm.server-port=8080 spring.cloud.alicloud.acm.server-port=8080
management.security.enabled=false

View File

@ -19,16 +19,12 @@ transport {
#auto default pin or 8 #auto default pin or 8
worker-thread-size = 8 worker-thread-size = 8
} }
} shutdown {
store { # when destroy server, wait seconds
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions wait = 3
max-branch-session-size = 16384 }
# globe session size , if exceeded throws exceptions serialization = "seata"
max-global-session-size = 512 compressor = "none"
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
} }
service { service {
#vgroup->rgroup #vgroup->rgroup
@ -39,6 +35,9 @@ service {
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
max.commit.retry.timeout = "-1"
max.rollback.retry.timeout = "-1"
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
@ -46,4 +45,18 @@ client {
retry.internal = 10 retry.internal = 10
retry.times = 30 retry.times = 30
} }
report.retry.count = 5
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
} }

View File

@ -1,5 +1,5 @@
registry { registry {
# file 、nacos 、eureka、redis、zk、consul # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "file" type = "file"
nacos { nacos {
@ -8,7 +8,7 @@ registry {
cluster = "default" cluster = "default"
} }
eureka { eureka {
serviceUrl = "http://localhost:1001/eureka" serviceUrl = "http://localhost:8761/eureka"
application = "default" application = "default"
weight = "1" weight = "1"
} }
@ -26,13 +26,26 @@ registry {
cluster = "default" cluster = "default"
serverAddr = "127.0.0.1:8500" serverAddr = "127.0.0.1:8500"
} }
etcd3 {
cluster = "default"
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
application = "default"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
cluster = "default"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file { file {
name = "file.conf" name = "file.conf"
} }
} }
config { config {
# file、nacos 、apollo、zk # file、nacos 、apollo、zk、consul、etcd3
type = "file" type = "file"
nacos { nacos {
@ -40,8 +53,11 @@ config {
namespace = "public" namespace = "public"
cluster = "default" cluster = "default"
} }
consul {
serverAddr = "127.0.0.1:8500"
}
apollo { apollo {
app.id = "fescar-server" app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801" apollo.meta = "http://192.168.1.204:8801"
} }
zk { zk {
@ -49,6 +65,9 @@ config {
session.timeout = 6000 session.timeout = 6000
connect.timeout = 2000 connect.timeout = 2000
} }
etcd3 {
serverAddr = "http://localhost:2379"
}
file { file {
name = "file.conf" name = "file.conf"
} }

View File

@ -19,36 +19,12 @@ transport {
#auto default pin or 8 #auto default pin or 8
worker-thread-size = 8 worker-thread-size = 8
} }
} shutdown {
## transaction log store # when destroy server, wait seconds
store { wait = 3
## store mode: file、db
mode = "file"
## file store
file {
dir = "sessionStore"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
# async, sync
flush-disk-mode = async
} }
serialization = "seata"
## database store compressor = "none"
db {
driver_class = ""
url = ""
user = ""
password = ""
}
} }
service { service {
#vgroup->rgroup #vgroup->rgroup
@ -59,6 +35,9 @@ service {
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
max.commit.retry.timeout = "-1"
max.rollback.retry.timeout = "-1"
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
@ -66,4 +45,18 @@ client {
retry.internal = 10 retry.internal = 10
retry.times = 30 retry.times = 30
} }
report.retry.count = 5
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
} }

View File

@ -8,7 +8,7 @@ registry {
cluster = "default" cluster = "default"
} }
eureka { eureka {
serviceUrl = "http://localhost:1001/eureka" serviceUrl = "http://localhost:8761/eureka"
application = "default" application = "default"
weight = "1" weight = "1"
} }
@ -45,7 +45,7 @@ registry {
} }
config { config {
# file、nacos 、apollo、zk # file、nacos 、apollo、zk、consul、etcd3
type = "file" type = "file"
nacos { nacos {
@ -53,6 +53,9 @@ config {
namespace = "public" namespace = "public"
cluster = "default" cluster = "default"
} }
consul {
serverAddr = "127.0.0.1:8500"
}
apollo { apollo {
app.id = "seata-server" app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801" apollo.meta = "http://192.168.1.204:8801"
@ -62,6 +65,9 @@ config {
session.timeout = 6000 session.timeout = 6000
connect.timeout = 2000 connect.timeout = 2000
} }
etcd3 {
serverAddr = "http://localhost:2379"
}
file { file {
name = "file.conf" name = "file.conf"
} }

View File

@ -19,36 +19,12 @@ transport {
#auto default pin or 8 #auto default pin or 8
worker-thread-size = 8 worker-thread-size = 8
} }
} shutdown {
## transaction log store # when destroy server, wait seconds
store { wait = 3
## store mode: file、db
mode = "file"
## file store
file {
dir = "sessionStore"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
# async, sync
flush-disk-mode = async
} }
serialization = "seata"
## database store compressor = "none"
db {
driver_class = ""
url = ""
user = ""
password = ""
}
} }
service { service {
#vgroup->rgroup #vgroup->rgroup
@ -59,6 +35,9 @@ service {
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
max.commit.retry.timeout = "-1"
max.rollback.retry.timeout = "-1"
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
@ -66,4 +45,18 @@ client {
retry.internal = 10 retry.internal = 10
retry.times = 30 retry.times = 30
} }
report.retry.count = 5
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
} }

View File

@ -8,7 +8,7 @@ registry {
cluster = "default" cluster = "default"
} }
eureka { eureka {
serviceUrl = "http://localhost:1001/eureka" serviceUrl = "http://localhost:8761/eureka"
application = "default" application = "default"
weight = "1" weight = "1"
} }
@ -45,7 +45,7 @@ registry {
} }
config { config {
# file、nacos 、apollo、zk # file、nacos 、apollo、zk、consul、etcd3
type = "file" type = "file"
nacos { nacos {
@ -53,6 +53,9 @@ config {
namespace = "public" namespace = "public"
cluster = "default" cluster = "default"
} }
consul {
serverAddr = "127.0.0.1:8500"
}
apollo { apollo {
app.id = "seata-server" app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801" apollo.meta = "http://192.168.1.204:8801"
@ -62,6 +65,9 @@ config {
session.timeout = 6000 session.timeout = 6000
connect.timeout = 2000 connect.timeout = 2000
} }
etcd3 {
serverAddr = "http://localhost:2379"
}
file { file {
name = "file.conf" name = "file.conf"
} }

View File

@ -50,6 +50,7 @@ CREATE TABLE `undo_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT, `id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL, `branch_id` bigint(20) NOT NULL,
`xid` varchar(100) NOT NULL, `xid` varchar(100) NOT NULL,
`context` varchar(128) NOT NULL,
`rollback_info` longblob NOT NULL, `rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL, `log_status` int(11) NOT NULL,
`log_created` datetime NOT NULL, `log_created` datetime NOT NULL,
@ -101,13 +102,13 @@ CREATE TABLE `account_tbl` (
进入解压之后的 bin 目录,执行如下命令来启动 进入解压之后的 bin 目录,执行如下命令来启动
```$shell ```$shell
sh seata-server.sh $LISTEN_PORT $MODE(file or db) sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db)
``` ```
在这个示例中,采用如下命令来启动 Seata Server 在这个示例中,采用如下命令来启动 Seata Server
```$shell ```$shell
sh seata-server.sh 8091 file sh seata-server.sh -p 8091 -m file
``` ```
**注意** 如果你修改了endpoint且注册中心使用默认file类型那么记得需要在各个示例工程中的 `file.conf` 文件中,修改 grouplist 的值(当registry.conf 中registry.type 或 config.type 为file 时会读取内部的file节点中的文件名若type不为file将直接从配置类型的对应元数据的注册配置中心读取数据),推荐大家使用 nacos 作为配置注册中心。 **注意** 如果你修改了endpoint且注册中心使用默认file类型那么记得需要在各个示例工程中的 `file.conf` 文件中,修改 grouplist 的值(当registry.conf 中registry.type 或 config.type 为file 时会读取内部的file节点中的文件名若type不为file将直接从配置类型的对应元数据的注册配置中心读取数据),推荐大家使用 nacos 作为配置注册中心。

View File

@ -19,36 +19,12 @@ transport {
#auto default pin or 8 #auto default pin or 8
worker-thread-size = 8 worker-thread-size = 8
} }
} shutdown {
## transaction log store # when destroy server, wait seconds
store { wait = 3
## store mode: file、db
mode = "file"
## file store
file {
dir = "sessionStore"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size , if exceeded throws exceptions
max-global-session-size = 512
# file buffer size , if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size = 100
# async, sync
flush-disk-mode = async
} }
serialization = "seata"
## database store compressor = "none"
db {
driver_class = ""
url = ""
user = ""
password = ""
}
} }
service { service {
#vgroup->rgroup #vgroup->rgroup
@ -59,6 +35,9 @@ service {
enableDegrade = false enableDegrade = false
#disable #disable
disable = false disable = false
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
max.commit.retry.timeout = "-1"
max.rollback.retry.timeout = "-1"
} }
client { client {
async.commit.buffer.limit = 10000 async.commit.buffer.limit = 10000
@ -66,4 +45,18 @@ client {
retry.internal = 10 retry.internal = 10
retry.times = 30 retry.times = 30
} }
report.retry.count = 5
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
} }

View File

@ -8,7 +8,7 @@ registry {
cluster = "default" cluster = "default"
} }
eureka { eureka {
serviceUrl = "http://localhost:1001/eureka" serviceUrl = "http://localhost:8761/eureka"
application = "default" application = "default"
weight = "1" weight = "1"
} }
@ -45,7 +45,7 @@ registry {
} }
config { config {
# file、nacos 、apollo、zk # file、nacos 、apollo、zk、consul、etcd3
type = "file" type = "file"
nacos { nacos {
@ -53,6 +53,9 @@ config {
namespace = "public" namespace = "public"
cluster = "default" cluster = "default"
} }
consul {
serverAddr = "127.0.0.1:8500"
}
apollo { apollo {
app.id = "seata-server" app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801" apollo.meta = "http://192.168.1.204:8801"
@ -62,6 +65,9 @@ config {
session.timeout = 6000 session.timeout = 6000
connect.timeout = 2000 connect.timeout = 2000
} }
etcd3 {
serverAddr = "http://localhost:2379"
}
file { file {
name = "file.conf" name = "file.conf"
} }

View File

@ -155,6 +155,21 @@ public class NacosDiscoveryProperties {
*/ */
private String secretKey; private String secretKey;
/**
* Heart beat interval. Time unit: second.
*/
private Integer heartBeatInterval;
/**
* Heart beat timeout. Time unit: second.
*/
private Integer heartBeatTimeout;
/**
* Ip delete timeout. Time unit: second.
*/
private Integer ipDeleteTimeout;
@Autowired @Autowired
private InetUtils inetUtils; private InetUtils inetUtils;
@ -339,6 +354,30 @@ public class NacosDiscoveryProperties {
this.secretKey = secretKey; this.secretKey = secretKey;
} }
public Integer getHeartBeatInterval() {
return heartBeatInterval;
}
public void setHeartBeatInterval(Integer heartBeatInterval) {
this.heartBeatInterval = heartBeatInterval;
}
public Integer getHeartBeatTimeout() {
return heartBeatTimeout;
}
public void setHeartBeatTimeout(Integer heartBeatTimeout) {
this.heartBeatTimeout = heartBeatTimeout;
}
public Integer getIpDeleteTimeout() {
return ipDeleteTimeout;
}
public void setIpDeleteTimeout(Integer ipDeleteTimeout) {
this.ipDeleteTimeout = ipDeleteTimeout;
}
public String getNamingLoadCacheAtStart() { public String getNamingLoadCacheAtStart() {
return namingLoadCacheAtStart; return namingLoadCacheAtStart;
} }

View File

@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.PreservedMetadataKeys;
/** /**
* @author xiaojing * @author xiaojing
@ -53,11 +54,10 @@ public class NacosRegistration implements Registration, ServiceInstance {
@PostConstruct @PostConstruct
public void init() { public void init() {
Map<String, String> metadata = nacosDiscoveryProperties.getMetadata();
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
Integer managementPort = ManagementServerPortUtils.getPort(context); Integer managementPort = ManagementServerPortUtils.getPort(context);
if (null != managementPort) { if (null != managementPort) {
Map<String, String> metadata = nacosDiscoveryProperties.getMetadata();
metadata.put(MANAGEMENT_PORT, managementPort.toString()); metadata.put(MANAGEMENT_PORT, managementPort.toString());
String contextPath = env.getProperty("management.context-path"); String contextPath = env.getProperty("management.context-path");
String address = env.getProperty("management.address"); String address = env.getProperty("management.address");
@ -68,6 +68,19 @@ public class NacosRegistration implements Registration, ServiceInstance {
metadata.put(MANAGEMENT_ADDRESS, address); metadata.put(MANAGEMENT_ADDRESS, address);
} }
} }
if (null != nacosDiscoveryProperties.getHeartBeatInterval()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL,
nacosDiscoveryProperties.getHeartBeatInterval().toString());
}
if (null != nacosDiscoveryProperties.getHeartBeatTimeout()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT,
nacosDiscoveryProperties.getHeartBeatTimeout().toString());
}
if (null != nacosDiscoveryProperties.getIpDeleteTimeout()) {
metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT,
nacosDiscoveryProperties.getIpDeleteTimeout().toString());
}
} }
@Override @Override

View File

@ -16,7 +16,7 @@
<dependency> <dependency>
<groupId>io.seata</groupId> <groupId>io.seata</groupId>
<artifactId>seata-spring</artifactId> <artifactId>seata-all</artifactId>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -93,9 +93,13 @@ public class SentinelInvocationHandler implements InvocationHandler {
MethodMetadata methodMetadata = SentinelContractHolder.metadataMap MethodMetadata methodMetadata = SentinelContractHolder.metadataMap
.get(hardCodedTarget.type().getName() .get(hardCodedTarget.type().getName()
+ Feign.configKey(hardCodedTarget.type(), method)); + Feign.configKey(hardCodedTarget.type(), method));
if (methodMetadata == null) {
result = methodHandler.invoke(args);
}
else {
// resource default is HttpMethod:protocol://url // resource default is HttpMethod:protocol://url
String resourceName = methodMetadata.template().method().toUpperCase() + ":" String resourceName = methodMetadata.template().method().toUpperCase()
+ hardCodedTarget.url() + methodMetadata.template().url(); + ":" + hardCodedTarget.url() + methodMetadata.template().url();
Entry entry = null; Entry entry = null;
try { try {
ContextUtil.enter(resourceName); ContextUtil.enter(resourceName);
@ -114,7 +118,8 @@ public class SentinelInvocationHandler implements InvocationHandler {
return fallbackResult; return fallbackResult;
} }
catch (IllegalAccessException e) { catch (IllegalAccessException e) {
// shouldn't happen as method is public due to being an interface // shouldn't happen as method is public due to being an
// interface
throw new AssertionError(e); throw new AssertionError(e);
} }
catch (InvocationTargetException e) { catch (InvocationTargetException e) {
@ -133,6 +138,7 @@ public class SentinelInvocationHandler implements InvocationHandler {
ContextUtil.exit(); ContextUtil.exit();
} }
} }
}
else { else {
// other target type using default strategy // other target type using default strategy
result = methodHandler.invoke(args); result = methodHandler.invoke(args);

View File

@ -18,6 +18,7 @@ package com.alibaba.alicloud.acm;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.context.refresh.ContextRefresher; import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
@ -37,6 +38,7 @@ import com.taobao.diamond.client.Diamond;
*/ */
@Configuration @Configuration
@ConditionalOnClass({ Diamond.class }) @ConditionalOnClass({ Diamond.class })
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
public class AcmAutoConfiguration implements ApplicationContextAware { public class AcmAutoConfiguration implements ApplicationContextAware {
private ApplicationContext applicationContext; private ApplicationContext applicationContext;

View File

@ -17,6 +17,7 @@
package com.alibaba.alicloud.acm.bootstrap; package com.alibaba.alicloud.acm.bootstrap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.bootstrap.config.PropertySourceLocator; import org.springframework.cloud.bootstrap.config.PropertySourceLocator;
import org.springframework.core.env.CompositePropertySource; import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
@ -28,6 +29,7 @@ import com.alibaba.alicloud.context.acm.AcmIntegrationProperties;
* @author juven.xuxb * @author juven.xuxb
* @author xiaolongzuo * @author xiaolongzuo
*/ */
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
public class AcmPropertySourceLocator implements PropertySourceLocator { public class AcmPropertySourceLocator implements PropertySourceLocator {
private static final String DIAMOND_PROPERTY_SOURCE_NAME = "diamond"; private static final String DIAMOND_PROPERTY_SOURCE_NAME = "diamond";

View File

@ -19,6 +19,7 @@ package com.alibaba.alicloud.acm.endpoint;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -31,6 +32,7 @@ import com.alibaba.alicloud.context.acm.AcmProperties;
*/ */
@ConditionalOnWebApplication @ConditionalOnWebApplication
@ConditionalOnClass(name = "org.springframework.boot.actuate.endpoint.AbstractEndpoint") @ConditionalOnClass(name = "org.springframework.boot.actuate.endpoint.AbstractEndpoint")
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
public class AcmEndpointAutoConfiguration { public class AcmEndpointAutoConfiguration {
@Autowired @Autowired

View File

@ -4,6 +4,12 @@
"name": "spring.application.group", "name": "spring.application.group",
"type": "java.lang.String", "type": "java.lang.String",
"description": "spring application group." "description": "spring application group."
},
{
"name": "spring.cloud.alicloud.acm.enabled",
"type": "java.lang.Boolean",
"defaultValue": true,
"description": "enable acm or not."
} }
] ]
} }