chore(project): 添加项目配置文件和忽略规则
- 添加 Babel 配置文件支持 ES6+ 语法转换 - 添加 ESLint 忽略规则和配置文件 - 添加 Git 忽略规则文件 - 添加 Travis CI 配置文件 - 添加 1.4.2 版本变更日志文件 - 添加 Helm 图表辅助模板文件 - 添加 Helm 忽略规则文件
This commit is contained in:
67
seata-spring-boot-starter/pom.xml
Normal file
67
seata-spring-boot-starter/pom.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 1999-2019 Seata.io Group.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<!-- <artifactId>seata-spring-boot-starter</artifactId>-->
|
||||
<artifactId>ftb-seata-spring-boot-starter</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ftb-seata-spring-boot-starter ${project.version}</name>
|
||||
|
||||
<properties>
|
||||
<spring-boot.version>1.5.22.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!--seata-->
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>seata-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--spring-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import io.seata.integration.http.HttpHandlerExceptionResolver;
|
||||
import io.seata.integration.http.TransactionPropagationInterceptor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Auto bean add for spring context if in springboot env.
|
||||
*
|
||||
* @author wangxb
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
public class HttpAutoConfiguration extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new TransactionPropagationInterceptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
|
||||
exceptionResolvers.add(new HttpHandlerExceptionResolver());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import io.seata.spring.annotation.GlobalTransactionScanner;
|
||||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties;
|
||||
import io.seata.tm.api.DefaultFailureHandlerImpl;
|
||||
import io.seata.tm.api.FailureHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
import static io.seata.common.Constants.BEAN_NAME_FAILURE_HANDLER;
|
||||
import static io.seata.common.Constants.BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SEATA_PREFIX;
|
||||
|
||||
/**
|
||||
* The type Seata auto configuration
|
||||
*
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@ConditionalOnProperty(prefix = SEATA_PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class SeataAutoConfiguration {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SeataAutoConfiguration.class);
|
||||
|
||||
@Bean(BEAN_NAME_FAILURE_HANDLER)
|
||||
@ConditionalOnMissingBean(FailureHandler.class)
|
||||
public FailureHandler failureHandler() {
|
||||
return new DefaultFailureHandlerImpl();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@DependsOn({BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER, BEAN_NAME_FAILURE_HANDLER})
|
||||
@ConditionalOnMissingBean(GlobalTransactionScanner.class)
|
||||
public GlobalTransactionScanner globalTransactionScanner(SeataProperties seataProperties, FailureHandler failureHandler) {
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
LOGGER.info("Automatically configure Seata");
|
||||
}
|
||||
return new GlobalTransactionScanner(seataProperties.getApplicationId(), seataProperties.getTxServiceGroup(), failureHandler);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import io.seata.spring.annotation.datasource.SeataAutoDataSourceProxyCreator;
|
||||
import io.seata.spring.annotation.datasource.SeataDataSourceBeanPostProcessor;
|
||||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import static io.seata.spring.annotation.datasource.AutoDataSourceProxyRegistrar.BEAN_NAME_SEATA_AUTO_DATA_SOURCE_PROXY_CREATOR;
|
||||
import static io.seata.spring.annotation.datasource.AutoDataSourceProxyRegistrar.BEAN_NAME_SEATA_DATA_SOURCE_BEAN_POST_PROCESSOR;
|
||||
|
||||
/**
|
||||
* The type Seata data source auto configuration.
|
||||
*
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@ConditionalOnExpression("${seata.enable:true} && ${seata.enableAutoDataSourceProxy:true} && ${seata.enable-auto-data-source-proxy:true}")
|
||||
public class SeataDataSourceAutoConfiguration {
|
||||
|
||||
/**
|
||||
* The bean seataDataSourceBeanPostProcessor.
|
||||
*/
|
||||
@Bean(BEAN_NAME_SEATA_DATA_SOURCE_BEAN_POST_PROCESSOR)
|
||||
@ConditionalOnMissingBean(SeataDataSourceBeanPostProcessor.class)
|
||||
public SeataDataSourceBeanPostProcessor seataDataSourceBeanPostProcessor(SeataProperties seataProperties) {
|
||||
return new SeataDataSourceBeanPostProcessor(seataProperties.getExcludesForAutoProxying(), seataProperties.getDataSourceProxyMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* The bean seataAutoDataSourceProxyCreator.
|
||||
*/
|
||||
@Bean(BEAN_NAME_SEATA_AUTO_DATA_SOURCE_PROXY_CREATOR)
|
||||
@ConditionalOnMissingBean(SeataAutoDataSourceProxyCreator.class)
|
||||
public SeataAutoDataSourceProxyCreator seataAutoDataSourceProxyCreator(SeataProperties seataProperties) {
|
||||
return new SeataAutoDataSourceProxyCreator(seataProperties.isUseJdkProxy(),
|
||||
seataProperties.getExcludesForAutoProxying(), seataProperties.getDataSourceProxyMode());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import io.seata.config.springcloud.SpringApplicationContextProvider;
|
||||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.LockProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.LogProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.RmProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ServiceProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ShutdownProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.TmProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.TransportProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.UndoCompressProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.UndoProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigApolloProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigConsulProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigCustomProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigEtcd3Properties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigFileProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigNacosProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigZooKeeperProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryConsulProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryCustomProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryEtcd3Properties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryEurekaProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryNacosProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryRedisProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistrySofaProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryZooKeeperProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.LoadBalanceProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
import static io.seata.common.Constants.BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CLIENT_RM_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CLIENT_TM_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.COMPRESS_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_APOLLO_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_CONSUL_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_CUSTOM_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_ETCD3_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_FILE_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_NACOS_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_ZK_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOCK_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOG_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_CONSUL_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_CUSTOM_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_ETCD3_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_EUREKA_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_NACOS_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_REDIS_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_SOFA_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_ZK_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SEATA_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SERVICE_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SHUTDOWN_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.THREAD_FACTORY_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.TRANSPORT_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.UNDO_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOAD_BALANCE_PREFIX;
|
||||
|
||||
/**
|
||||
* The type Seata properties auto configuration
|
||||
*
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@ConditionalOnProperty(prefix = SEATA_PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ComponentScan(basePackages = "io.seata.spring.boot.autoconfigure.properties")
|
||||
@AutoConfigureBefore({SeataAutoConfiguration.class, SeataDataSourceAutoConfiguration.class})
|
||||
public class SeataPropertiesAutoConfiguration {
|
||||
static {
|
||||
|
||||
PROPERTY_BEAN_MAP.put(SEATA_PREFIX, SeataProperties.class);
|
||||
|
||||
PROPERTY_BEAN_MAP.put(CLIENT_RM_PREFIX, RmProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CLIENT_TM_PREFIX, TmProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(LOCK_PREFIX, LockProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(SERVICE_PREFIX, ServiceProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(SHUTDOWN_PREFIX, ShutdownProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(THREAD_FACTORY_PREFIX, ThreadFactoryProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(UNDO_PREFIX, UndoProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(COMPRESS_PREFIX, UndoCompressProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(LOG_PREFIX, LogProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(TRANSPORT_PREFIX, TransportProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_PREFIX, ConfigProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_FILE_PREFIX, ConfigFileProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_PREFIX, RegistryProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(LOAD_BALANCE_PREFIX, LoadBalanceProperties.class);
|
||||
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_NACOS_PREFIX, ConfigNacosProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_CONSUL_PREFIX, ConfigConsulProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_ZK_PREFIX, ConfigZooKeeperProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_APOLLO_PREFIX, ConfigApolloProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_ETCD3_PREFIX, ConfigEtcd3Properties.class);
|
||||
PROPERTY_BEAN_MAP.put(CONFIG_CUSTOM_PREFIX, ConfigCustomProperties.class);
|
||||
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_CONSUL_PREFIX, RegistryConsulProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_ETCD3_PREFIX, RegistryEtcd3Properties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_EUREKA_PREFIX, RegistryEurekaProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_NACOS_PREFIX, RegistryNacosProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_REDIS_PREFIX, RegistryRedisProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_SOFA_PREFIX, RegistrySofaProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_ZK_PREFIX, RegistryZooKeeperProperties.class);
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_CUSTOM_PREFIX, RegistryCustomProperties.class);
|
||||
|
||||
}
|
||||
|
||||
@Bean(BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER)
|
||||
@ConditionalOnMissingBean(name = {BEAN_NAME_SPRING_APPLICATION_CONTEXT_PROVIDER})
|
||||
public SpringApplicationContextProvider springApplicationContextProvider() {
|
||||
return new SpringApplicationContextProvider();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
public interface StarterConstants {
|
||||
String SEATA_PREFIX = "seata";
|
||||
String SEATA_SPRING_CLOUD_ALIBABA_PREFIX = "spring.cloud.alibaba.seata";
|
||||
String TRANSPORT_PREFIX = SEATA_PREFIX + ".transport";
|
||||
String THREAD_FACTORY_PREFIX_KEBAB_STYLE = TRANSPORT_PREFIX + ".thread-factory";
|
||||
String THREAD_FACTORY_PREFIX = TRANSPORT_PREFIX + ".threadFactory";
|
||||
String SHUTDOWN_PREFIX = TRANSPORT_PREFIX + ".shutdown";
|
||||
String SERVICE_PREFIX = SEATA_PREFIX + ".service";
|
||||
String CLIENT_PREFIX = SEATA_PREFIX + ".client";
|
||||
String CLIENT_RM_PREFIX = CLIENT_PREFIX + ".rm";
|
||||
String CLIENT_TM_PREFIX = CLIENT_PREFIX + ".tm";
|
||||
String LOCK_PREFIX = CLIENT_RM_PREFIX + ".lock";
|
||||
String UNDO_PREFIX = CLIENT_PREFIX + ".undo";
|
||||
String LOAD_BALANCE_PREFIX_KEBAB_STYLE = CLIENT_PREFIX + ".load-balance";
|
||||
String LOAD_BALANCE_PREFIX = CLIENT_PREFIX + ".loadBalance";
|
||||
String LOG_PREFIX = SEATA_PREFIX + ".log";
|
||||
String COMPRESS_PREFIX = UNDO_PREFIX + ".compress";
|
||||
|
||||
String REGISTRY_PREFIX = SEATA_PREFIX + ".registry";
|
||||
String REGISTRY_NACOS_PREFIX = REGISTRY_PREFIX + ".nacos";
|
||||
String REGISTRY_EUREKA_PREFIX = REGISTRY_PREFIX + ".eureka";
|
||||
String REGISTRY_REDIS_PREFIX = REGISTRY_PREFIX + ".redis";
|
||||
String REGISTRY_ZK_PREFIX = REGISTRY_PREFIX + ".zk";
|
||||
String REGISTRY_CONSUL_PREFIX = REGISTRY_PREFIX + ".consul";
|
||||
String REGISTRY_ETCD3_PREFIX = REGISTRY_PREFIX + ".etcd3";
|
||||
String REGISTRY_SOFA_PREFIX = REGISTRY_PREFIX + ".sofa";
|
||||
String REGISTRY_CUSTOM_PREFIX = REGISTRY_PREFIX + ".custom";
|
||||
|
||||
String CONFIG_PREFIX = SEATA_PREFIX + ".config";
|
||||
String CONFIG_NACOS_PREFIX = CONFIG_PREFIX + ".nacos";
|
||||
String CONFIG_CONSUL_PREFIX = CONFIG_PREFIX + ".consul";
|
||||
String CONFIG_ETCD3_PREFIX = CONFIG_PREFIX + ".etcd3";
|
||||
String CONFIG_APOLLO_PREFIX = CONFIG_PREFIX + ".apollo";
|
||||
String CONFIG_ZK_PREFIX = CONFIG_PREFIX + ".zk";
|
||||
String CONFIG_FILE_PREFIX = CONFIG_PREFIX + ".file";
|
||||
String CONFIG_CUSTOM_PREFIX = CONFIG_PREFIX + ".custom";
|
||||
|
||||
int MAP_CAPACITY = 64;
|
||||
HashMap<String, Class<?>> PROPERTY_BEAN_MAP = new HashMap<>(MAP_CAPACITY);
|
||||
/**
|
||||
* The following special keys need to be normalized.
|
||||
*/
|
||||
String SPECIAL_KEY_GROUPLIST = "grouplist";
|
||||
String SPECIAL_KEY_VGROUP_MAPPING = "vgroupMapping";
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties;
|
||||
|
||||
import io.seata.common.DefaultValues;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SEATA_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = SEATA_PREFIX)
|
||||
public class SeataProperties {
|
||||
/**
|
||||
* whether enable auto configuration
|
||||
*/
|
||||
private boolean enabled = true;
|
||||
/**
|
||||
* application id
|
||||
*/
|
||||
private String applicationId;
|
||||
/**
|
||||
* transaction service group
|
||||
*/
|
||||
private String txServiceGroup;
|
||||
/**
|
||||
* Whether enable auto proxying of datasource bean
|
||||
*/
|
||||
private boolean enableAutoDataSourceProxy = true;
|
||||
/**
|
||||
* data source proxy mode
|
||||
*/
|
||||
private String dataSourceProxyMode = DefaultValues.DEFAULT_DATA_SOURCE_PROXY_MODE;
|
||||
/**
|
||||
* Whether use JDK proxy instead of CGLIB proxy
|
||||
*/
|
||||
private boolean useJdkProxy = false;
|
||||
/**
|
||||
* Specifies which datasource bean are not eligible for auto-proxying
|
||||
*/
|
||||
private String[] excludesForAutoProxying = {};
|
||||
|
||||
@Autowired
|
||||
private SpringCloudAlibabaConfiguration springCloudAlibabaConfiguration;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public SeataProperties setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApplicationId() {
|
||||
if (applicationId == null) {
|
||||
applicationId = springCloudAlibabaConfiguration.getApplicationId();
|
||||
}
|
||||
return applicationId;
|
||||
}
|
||||
|
||||
public SeataProperties setApplicationId(String applicationId) {
|
||||
this.applicationId = applicationId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTxServiceGroup() {
|
||||
if (txServiceGroup == null) {
|
||||
txServiceGroup = springCloudAlibabaConfiguration.getTxServiceGroup();
|
||||
}
|
||||
return txServiceGroup;
|
||||
}
|
||||
|
||||
public SeataProperties setTxServiceGroup(String txServiceGroup) {
|
||||
this.txServiceGroup = txServiceGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEnableAutoDataSourceProxy() {
|
||||
return enableAutoDataSourceProxy;
|
||||
}
|
||||
|
||||
public SeataProperties setEnableAutoDataSourceProxy(boolean enableAutoDataSourceProxy) {
|
||||
this.enableAutoDataSourceProxy = enableAutoDataSourceProxy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataSourceProxyMode() {
|
||||
return dataSourceProxyMode;
|
||||
}
|
||||
|
||||
public void setDataSourceProxyMode(String dataSourceProxyMode) {
|
||||
this.dataSourceProxyMode = dataSourceProxyMode;
|
||||
}
|
||||
|
||||
public boolean isUseJdkProxy() {
|
||||
return useJdkProxy;
|
||||
}
|
||||
|
||||
public SeataProperties setUseJdkProxy(boolean useJdkProxy) {
|
||||
this.useJdkProxy = useJdkProxy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getExcludesForAutoProxying() {
|
||||
return excludesForAutoProxying;
|
||||
}
|
||||
|
||||
public SeataProperties setExcludesForAutoProxying(String[] excludesForAutoProxying) {
|
||||
this.excludesForAutoProxying = excludesForAutoProxying;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties;
|
||||
|
||||
import io.seata.spring.boot.autoconfigure.StarterConstants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* The type Spring cloud alibaba configuration.
|
||||
*
|
||||
* @author slievrly
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = StarterConstants.SEATA_SPRING_CLOUD_ALIBABA_PREFIX)
|
||||
public class SpringCloudAlibabaConfiguration implements ApplicationContextAware {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SpringCloudAlibabaConfiguration.class);
|
||||
private static final String SPRING_APPLICATION_NAME_KEY = "spring.application.name";
|
||||
private static final String DEFAULT_SPRING_CLOUD_SERVICE_GROUP_POSTFIX = "-seata-service-group";
|
||||
private String applicationId;
|
||||
private String txServiceGroup;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* Gets application id.
|
||||
*
|
||||
* @return the application id
|
||||
*/
|
||||
public String getApplicationId() {
|
||||
if (applicationId == null) {
|
||||
applicationId = applicationContext.getEnvironment().getProperty(SPRING_APPLICATION_NAME_KEY);
|
||||
}
|
||||
return applicationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tx service group.
|
||||
*
|
||||
* @return the tx service group
|
||||
*/
|
||||
public String getTxServiceGroup() {
|
||||
if (txServiceGroup == null) {
|
||||
String applicationId = getApplicationId();
|
||||
if (applicationId == null) {
|
||||
LOGGER.warn("{} is null, please set its value", SPRING_APPLICATION_NAME_KEY);
|
||||
}
|
||||
txServiceGroup = applicationId + DEFAULT_SPRING_CLOUD_SERVICE_GROUP_POSTFIX;
|
||||
}
|
||||
return txServiceGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets tx service group.
|
||||
*
|
||||
* @param txServiceGroup the tx service group
|
||||
*/
|
||||
public void setTxServiceGroup(String txServiceGroup) {
|
||||
this.txServiceGroup = txServiceGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_LOCK_RETRY_INTERVAL;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_LOCK_RETRY_POLICY_BRANCH_ROLLBACK_ON_CONFLICT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_LOCK_RETRY_TIMES;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOCK_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = LOCK_PREFIX)
|
||||
public class LockProperties {
|
||||
private int retryInterval = DEFAULT_CLIENT_LOCK_RETRY_INTERVAL;
|
||||
private int retryTimes = DEFAULT_CLIENT_LOCK_RETRY_TIMES;
|
||||
private boolean retryPolicyBranchRollbackOnConflict = DEFAULT_CLIENT_LOCK_RETRY_POLICY_BRANCH_ROLLBACK_ON_CONFLICT;
|
||||
|
||||
public int getRetryInterval() {
|
||||
return retryInterval;
|
||||
}
|
||||
|
||||
public LockProperties setRetryInterval(int retryInterval) {
|
||||
this.retryInterval = retryInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRetryTimes() {
|
||||
return retryTimes;
|
||||
}
|
||||
|
||||
public LockProperties setRetryTimes(int retryTimes) {
|
||||
this.retryTimes = retryTimes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRetryPolicyBranchRollbackOnConflict() {
|
||||
return retryPolicyBranchRollbackOnConflict;
|
||||
}
|
||||
|
||||
public LockProperties setRetryPolicyBranchRollbackOnConflict(boolean retryPolicyBranchRollbackOnConflict) {
|
||||
this.retryPolicyBranchRollbackOnConflict = retryPolicyBranchRollbackOnConflict;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_LOG_EXCEPTION_RATE;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOG_PREFIX;
|
||||
|
||||
/**
|
||||
* @author jsbxyyx
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = LOG_PREFIX)
|
||||
public class LogProperties {
|
||||
|
||||
private int exceptionRate = DEFAULT_LOG_EXCEPTION_RATE;
|
||||
|
||||
public int getExceptionRate() {
|
||||
return exceptionRate;
|
||||
}
|
||||
|
||||
public LogProperties setExceptionRate(int exceptionRate) {
|
||||
this.exceptionRate = exceptionRate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_ASYNC_COMMIT_BUFFER_LIMIT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_REPORT_RETRY_COUNT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_REPORT_SUCCESS_ENABLE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_SAGA_BRANCH_REGISTER_ENABLE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_SAGA_COMPENSATE_PERSIST_MODE_UPDATE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_SAGA_RETRY_PERSIST_MODE_UPDATE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_CLIENT_TABLE_META_CHECK_ENABLE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_SAGA_JSON_PARSER;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TABLE_META_CHECKER_INTERVAL;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CLIENT_RM_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CLIENT_RM_PREFIX)
|
||||
public class RmProperties {
|
||||
private int asyncCommitBufferLimit = DEFAULT_CLIENT_ASYNC_COMMIT_BUFFER_LIMIT;
|
||||
private int reportRetryCount = DEFAULT_CLIENT_REPORT_RETRY_COUNT;
|
||||
private boolean tableMetaCheckEnable = DEFAULT_CLIENT_TABLE_META_CHECK_ENABLE;
|
||||
private long tableMetaCheckerInterval = DEFAULT_TABLE_META_CHECKER_INTERVAL;
|
||||
private boolean reportSuccessEnable = DEFAULT_CLIENT_REPORT_SUCCESS_ENABLE;
|
||||
private boolean sagaBranchRegisterEnable = DEFAULT_CLIENT_SAGA_BRANCH_REGISTER_ENABLE;
|
||||
private String sagaJsonParser = DEFAULT_SAGA_JSON_PARSER;
|
||||
private boolean sagaRetryPersistModeUpdate = DEFAULT_CLIENT_SAGA_RETRY_PERSIST_MODE_UPDATE;
|
||||
private boolean sagaCompensatePersistModeUpdate = DEFAULT_CLIENT_SAGA_COMPENSATE_PERSIST_MODE_UPDATE;
|
||||
|
||||
public int getAsyncCommitBufferLimit() {
|
||||
return asyncCommitBufferLimit;
|
||||
}
|
||||
|
||||
public RmProperties setAsyncCommitBufferLimit(int asyncCommitBufferLimit) {
|
||||
this.asyncCommitBufferLimit = asyncCommitBufferLimit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getReportRetryCount() {
|
||||
return reportRetryCount;
|
||||
}
|
||||
|
||||
public RmProperties setReportRetryCount(int reportRetryCount) {
|
||||
this.reportRetryCount = reportRetryCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isTableMetaCheckEnable() {
|
||||
return tableMetaCheckEnable;
|
||||
}
|
||||
|
||||
public RmProperties setTableMetaCheckEnable(boolean tableMetaCheckEnable) {
|
||||
this.tableMetaCheckEnable = tableMetaCheckEnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isReportSuccessEnable() {
|
||||
return reportSuccessEnable;
|
||||
}
|
||||
|
||||
public RmProperties setReportSuccessEnable(boolean reportSuccessEnable) {
|
||||
this.reportSuccessEnable = reportSuccessEnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSagaBranchRegisterEnable() {
|
||||
return sagaBranchRegisterEnable;
|
||||
}
|
||||
|
||||
public void setSagaBranchRegisterEnable(boolean sagaBranchRegisterEnable) {
|
||||
this.sagaBranchRegisterEnable = sagaBranchRegisterEnable;
|
||||
}
|
||||
|
||||
public String getSagaJsonParser() {
|
||||
return sagaJsonParser;
|
||||
}
|
||||
|
||||
public void setSagaJsonParser(String sagaJsonParser) {
|
||||
this.sagaJsonParser = sagaJsonParser;
|
||||
}
|
||||
|
||||
|
||||
public long getTableMetaCheckerInterval() {
|
||||
return tableMetaCheckerInterval;
|
||||
}
|
||||
|
||||
public void setTableMetaCheckerInterval(long tableMetaCheckerInterval) {
|
||||
this.tableMetaCheckerInterval = tableMetaCheckerInterval;
|
||||
}
|
||||
|
||||
public boolean isSagaRetryPersistModeUpdate() {
|
||||
return sagaRetryPersistModeUpdate;
|
||||
}
|
||||
|
||||
public void setSagaRetryPersistModeUpdate(boolean sagaRetryPersistModeUpdate) {
|
||||
this.sagaRetryPersistModeUpdate = sagaRetryPersistModeUpdate;
|
||||
}
|
||||
|
||||
public boolean isSagaCompensatePersistModeUpdate() {
|
||||
return sagaCompensatePersistModeUpdate;
|
||||
}
|
||||
|
||||
public void setSagaCompensatePersistModeUpdate(boolean sagaCompensatePersistModeUpdate) {
|
||||
this.sagaCompensatePersistModeUpdate = sagaCompensatePersistModeUpdate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_DISABLE_GLOBAL_TRANSACTION;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_GROUPLIST;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TC_CLUSTER;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TX_GROUP;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SERVICE_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = SERVICE_PREFIX)
|
||||
public class ServiceProperties implements InitializingBean {
|
||||
/**
|
||||
* vgroup->rgroup
|
||||
*/
|
||||
private Map<String, String> vgroupMapping = new HashMap<>();
|
||||
/**
|
||||
* group list
|
||||
*/
|
||||
private Map<String, String> grouplist = new HashMap<>();
|
||||
/**
|
||||
* degrade current not support
|
||||
*/
|
||||
private boolean enableDegrade = false;
|
||||
/**
|
||||
* disable globalTransaction
|
||||
*/
|
||||
private boolean disableGlobalTransaction = DEFAULT_DISABLE_GLOBAL_TRANSACTION;
|
||||
|
||||
public Map<String, String> getVgroupMapping() {
|
||||
return vgroupMapping;
|
||||
}
|
||||
|
||||
public void setVgroupMapping(Map<String, String> vgroupMapping) {
|
||||
this.vgroupMapping = vgroupMapping;
|
||||
}
|
||||
|
||||
public Map<String, String> getGrouplist() {
|
||||
return grouplist;
|
||||
}
|
||||
|
||||
public void setGrouplist(Map<String, String> grouplist) {
|
||||
this.grouplist = grouplist;
|
||||
}
|
||||
|
||||
public boolean isEnableDegrade() {
|
||||
return enableDegrade;
|
||||
}
|
||||
|
||||
public ServiceProperties setEnableDegrade(boolean enableDegrade) {
|
||||
this.enableDegrade = enableDegrade;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDisableGlobalTransaction() {
|
||||
return disableGlobalTransaction;
|
||||
}
|
||||
|
||||
public ServiceProperties setDisableGlobalTransaction(boolean disableGlobalTransaction) {
|
||||
this.disableGlobalTransaction = disableGlobalTransaction;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (0 == vgroupMapping.size()) {
|
||||
vgroupMapping.put(DEFAULT_TX_GROUP, DEFAULT_TC_CLUSTER);
|
||||
}
|
||||
if (0 == grouplist.size()) {
|
||||
grouplist.put(DEFAULT_TC_CLUSTER, DEFAULT_GROUPLIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_SHUTDOWN_TIMEOUT_SEC;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SHUTDOWN_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = SHUTDOWN_PREFIX)
|
||||
public class ShutdownProperties {
|
||||
/**
|
||||
* when destroy server, wait seconds
|
||||
*/
|
||||
private long wait = DEFAULT_SHUTDOWN_TIMEOUT_SEC;
|
||||
|
||||
public long getWait() {
|
||||
return wait;
|
||||
}
|
||||
|
||||
public ShutdownProperties setWait(long wait) {
|
||||
this.wait = wait;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import io.seata.core.rpc.netty.NettyBaseConfig.WorkThreadMode;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_BOSS_THREAD_PREFIX;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_BOSS_THREAD_SIZE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_EXECUTOR_THREAD_PREFIX;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_NIO_WORKER_THREAD_PREFIX;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_SELECTOR_THREAD_PREFIX;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_SELECTOR_THREAD_SIZE;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_WORKER_THREAD_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.THREAD_FACTORY_PREFIX_KEBAB_STYLE;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = THREAD_FACTORY_PREFIX_KEBAB_STYLE)
|
||||
public class ThreadFactoryProperties {
|
||||
private String bossThreadPrefix = DEFAULT_BOSS_THREAD_PREFIX;
|
||||
private String workerThreadPrefix = DEFAULT_NIO_WORKER_THREAD_PREFIX;
|
||||
private String serverExecutorThreadPrefix = DEFAULT_EXECUTOR_THREAD_PREFIX;
|
||||
private boolean shareBossWorker = false;
|
||||
private String clientSelectorThreadPrefix = DEFAULT_SELECTOR_THREAD_PREFIX;
|
||||
private int clientSelectorThreadSize = DEFAULT_SELECTOR_THREAD_SIZE;
|
||||
private String clientWorkerThreadPrefix = DEFAULT_WORKER_THREAD_PREFIX;
|
||||
/**
|
||||
* netty boss thread size
|
||||
*/
|
||||
private int bossThreadSize = DEFAULT_BOSS_THREAD_SIZE;
|
||||
/**
|
||||
* auto default pin or 8
|
||||
*/
|
||||
private String workerThreadSize = WorkThreadMode.Default.name();
|
||||
|
||||
public String getBossThreadPrefix() {
|
||||
return bossThreadPrefix;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setBossThreadPrefix(String bossThreadPrefix) {
|
||||
this.bossThreadPrefix = bossThreadPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWorkerThreadPrefix() {
|
||||
return workerThreadPrefix;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setWorkerThreadPrefix(String workerThreadPrefix) {
|
||||
this.workerThreadPrefix = workerThreadPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServerExecutorThreadPrefix() {
|
||||
return serverExecutorThreadPrefix;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setServerExecutorThreadPrefix(String serverExecutorThreadPrefix) {
|
||||
this.serverExecutorThreadPrefix = serverExecutorThreadPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isShareBossWorker() {
|
||||
return shareBossWorker;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setShareBossWorker(boolean shareBossWorker) {
|
||||
this.shareBossWorker = shareBossWorker;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getClientSelectorThreadPrefix() {
|
||||
return clientSelectorThreadPrefix;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setClientSelectorThreadPrefix(String clientSelectorThreadPrefix) {
|
||||
this.clientSelectorThreadPrefix = clientSelectorThreadPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getClientWorkerThreadPrefix() {
|
||||
return clientWorkerThreadPrefix;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setClientWorkerThreadPrefix(String clientWorkerThreadPrefix) {
|
||||
this.clientWorkerThreadPrefix = clientWorkerThreadPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getClientSelectorThreadSize() {
|
||||
return clientSelectorThreadSize;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setClientSelectorThreadSize(int clientSelectorThreadSize) {
|
||||
this.clientSelectorThreadSize = clientSelectorThreadSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getBossThreadSize() {
|
||||
return bossThreadSize;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setBossThreadSize(int bossThreadSize) {
|
||||
this.bossThreadSize = bossThreadSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWorkerThreadSize() {
|
||||
return workerThreadSize;
|
||||
}
|
||||
|
||||
public ThreadFactoryProperties setWorkerThreadSize(String workerThreadSize) {
|
||||
this.workerThreadSize = workerThreadSize;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_GLOBAL_TRANSACTION_TIMEOUT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_COMMIT_RETRY_COUNT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_DEGRADE_CHECK;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_DEGRADE_CHECK_ALLOW_TIMES;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_DEGRADE_CHECK_PERIOD;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_ROLLBACK_RETRY_COUNT;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CLIENT_TM_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CLIENT_TM_PREFIX)
|
||||
public class TmProperties {
|
||||
private int commitRetryCount = DEFAULT_TM_COMMIT_RETRY_COUNT;
|
||||
private int rollbackRetryCount = DEFAULT_TM_ROLLBACK_RETRY_COUNT;
|
||||
private int defaultGlobalTransactionTimeout = DEFAULT_GLOBAL_TRANSACTION_TIMEOUT;
|
||||
private boolean degradeCheck = DEFAULT_TM_DEGRADE_CHECK;
|
||||
private int degradeCheckAllowTimes = DEFAULT_TM_DEGRADE_CHECK_ALLOW_TIMES;
|
||||
private int degradeCheckPeriod = DEFAULT_TM_DEGRADE_CHECK_PERIOD;
|
||||
|
||||
public int getCommitRetryCount() {
|
||||
return commitRetryCount;
|
||||
}
|
||||
|
||||
public TmProperties setCommitRetryCount(int commitRetryCount) {
|
||||
this.commitRetryCount = commitRetryCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRollbackRetryCount() {
|
||||
return rollbackRetryCount;
|
||||
}
|
||||
|
||||
public TmProperties setRollbackRetryCount(int rollbackRetryCount) {
|
||||
this.rollbackRetryCount = rollbackRetryCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDefaultGlobalTransactionTimeout() {
|
||||
return defaultGlobalTransactionTimeout;
|
||||
}
|
||||
|
||||
public TmProperties setDefaultGlobalTransactionTimeout(int defaultGlobalTransactionTimeout) {
|
||||
this.defaultGlobalTransactionTimeout = defaultGlobalTransactionTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDegradeCheck() {
|
||||
return degradeCheck;
|
||||
}
|
||||
|
||||
public TmProperties setDegradeCheck(boolean degradeCheck) {
|
||||
this.degradeCheck = degradeCheck;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDegradeCheckPeriod() {
|
||||
return degradeCheckPeriod;
|
||||
}
|
||||
|
||||
public TmProperties setDegradeCheckPeriod(int degradeCheckPeriod) {
|
||||
this.degradeCheckPeriod = degradeCheckPeriod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDegradeCheckAllowTimes() {
|
||||
return degradeCheckAllowTimes;
|
||||
}
|
||||
|
||||
public void setDegradeCheckAllowTimes(int degradeCheckAllowTimes) {
|
||||
this.degradeCheckAllowTimes = degradeCheckAllowTimes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_ENABLE_CLIENT_BATCH_SEND_REQUEST;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TRANSPORT_HEARTBEAT;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.TRANSPORT_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = TRANSPORT_PREFIX)
|
||||
public class TransportProperties {
|
||||
/**
|
||||
* tcp, unix-domain-socket
|
||||
*/
|
||||
private String type = "TCP";
|
||||
/**
|
||||
* NIO, NATIVE
|
||||
*/
|
||||
private String server = "NIO";
|
||||
/**
|
||||
* enable heartbeat
|
||||
*/
|
||||
private boolean heartbeat = DEFAULT_TRANSPORT_HEARTBEAT;
|
||||
/**
|
||||
* serialization
|
||||
*/
|
||||
private String serialization = "seata";
|
||||
/**
|
||||
* compressor
|
||||
*/
|
||||
private String compressor = "none";
|
||||
|
||||
/**
|
||||
* enable client batch send request
|
||||
*/
|
||||
private boolean enableClientBatchSendRequest = DEFAULT_ENABLE_CLIENT_BATCH_SEND_REQUEST;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public TransportProperties setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public TransportProperties setServer(String server) {
|
||||
this.server = server;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isHeartbeat() {
|
||||
return heartbeat;
|
||||
}
|
||||
|
||||
public TransportProperties setHeartbeat(boolean heartbeat) {
|
||||
this.heartbeat = heartbeat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerialization() {
|
||||
return serialization;
|
||||
}
|
||||
|
||||
public TransportProperties setSerialization(String serialization) {
|
||||
this.serialization = serialization;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCompressor() {
|
||||
return compressor;
|
||||
}
|
||||
|
||||
public TransportProperties setCompressor(String compressor) {
|
||||
this.compressor = compressor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEnableClientBatchSendRequest() {
|
||||
return enableClientBatchSendRequest;
|
||||
}
|
||||
|
||||
public TransportProperties setEnableClientBatchSendRequest(boolean enableClientBatchSendRequest) {
|
||||
this.enableClientBatchSendRequest = enableClientBatchSendRequest;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import io.seata.common.DefaultValues;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.COMPRESS_PREFIX;
|
||||
|
||||
/**
|
||||
* @author chd
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = COMPRESS_PREFIX)
|
||||
public class UndoCompressProperties {
|
||||
private boolean enable = DefaultValues.DEFAULT_CLIENT_UNDO_COMPRESS_ENABLE;
|
||||
private String type = DefaultValues.DEFAULT_CLIENT_UNDO_COMPRESS_TYPE;
|
||||
private String threshold = DefaultValues.DEFAULT_CLIENT_UNDO_COMPRESS_THRESHOLD;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public UndoCompressProperties setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public UndoCompressProperties setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThreshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public UndoCompressProperties setThreshold(String threshold) {
|
||||
this.threshold = threshold;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.client;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_ONLY_CARE_UPDATE_COLUMNS;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TRANSACTION_UNDO_DATA_VALIDATION;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TRANSACTION_UNDO_LOG_SERIALIZATION;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TRANSACTION_UNDO_LOG_TABLE;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.UNDO_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = UNDO_PREFIX)
|
||||
public class UndoProperties {
|
||||
private boolean dataValidation = DEFAULT_TRANSACTION_UNDO_DATA_VALIDATION;
|
||||
private String logSerialization = DEFAULT_TRANSACTION_UNDO_LOG_SERIALIZATION;
|
||||
private String logTable = DEFAULT_TRANSACTION_UNDO_LOG_TABLE;
|
||||
private boolean onlyCareUpdateColumns = DEFAULT_ONLY_CARE_UPDATE_COLUMNS;
|
||||
|
||||
public boolean isDataValidation() {
|
||||
return dataValidation;
|
||||
}
|
||||
|
||||
public UndoProperties setDataValidation(boolean dataValidation) {
|
||||
this.dataValidation = dataValidation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLogSerialization() {
|
||||
return logSerialization;
|
||||
}
|
||||
|
||||
public UndoProperties setLogSerialization(String logSerialization) {
|
||||
this.logSerialization = logSerialization;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLogTable() {
|
||||
return logTable;
|
||||
}
|
||||
|
||||
public UndoProperties setLogTable(String logTable) {
|
||||
this.logTable = logTable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isOnlyCareUpdateColumns() {
|
||||
return onlyCareUpdateColumns;
|
||||
}
|
||||
|
||||
public UndoProperties setOnlyCareUpdateColumns(boolean onlyCareUpdateColumns) {
|
||||
this.onlyCareUpdateColumns = onlyCareUpdateColumns;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_APOLLO_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_APOLLO_PREFIX)
|
||||
public class ConfigApolloProperties {
|
||||
private String appId = "seata-server";
|
||||
private String apolloMeta = "http://192.168.1.204:8801";
|
||||
private String namespace = "application";
|
||||
private String apolloAccesskeySecret = "";
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public ConfigApolloProperties setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApolloMeta() {
|
||||
return apolloMeta;
|
||||
}
|
||||
|
||||
public ConfigApolloProperties setApolloMeta(String apolloMeta) {
|
||||
this.apolloMeta = apolloMeta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public ConfigApolloProperties setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApolloAccesskeySecret() {
|
||||
return apolloAccesskeySecret;
|
||||
}
|
||||
|
||||
public ConfigApolloProperties setApolloAccesskeySecret(String apolloAccesskeySecret) {
|
||||
this.apolloAccesskeySecret = apolloAccesskeySecret;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_CONSUL_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_CONSUL_PREFIX)
|
||||
public class ConfigConsulProperties {
|
||||
private String serverAddr = "127.0.0.1:8500";
|
||||
private String aclToken = "";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public ConfigConsulProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAclToken() {
|
||||
return aclToken;
|
||||
}
|
||||
|
||||
public ConfigConsulProperties setAclToken(String aclToken) {
|
||||
this.aclToken = aclToken;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_CUSTOM_PREFIX;
|
||||
|
||||
/**
|
||||
* @author jrial95@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_CUSTOM_PREFIX)
|
||||
public class ConfigCustomProperties {
|
||||
private String name = "";
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ConfigCustomProperties setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_ETCD3_PREFIX;
|
||||
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_ETCD3_PREFIX)
|
||||
public class ConfigEtcd3Properties {
|
||||
private String serverAddr = "http://localhost:2379";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public ConfigEtcd3Properties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_FILE_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_FILE_PREFIX)
|
||||
public class ConfigFileProperties {
|
||||
private String name = "file.conf";
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ConfigFileProperties setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_NACOS_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_NACOS_PREFIX)
|
||||
public class ConfigNacosProperties {
|
||||
private String serverAddr = "localhost";
|
||||
private String namespace = "";
|
||||
private String group = "SEATA_GROUP";
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
private String dataId = "seata.properties";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setGroup(String group) {
|
||||
this.group = group;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataId() {
|
||||
return dataId;
|
||||
}
|
||||
|
||||
public ConfigNacosProperties setDataId(String dataId) {
|
||||
this.dataId = dataId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_PREFIX)
|
||||
public class ConfigProperties {
|
||||
/**
|
||||
* file, nacos, apollo, zk, consul, etcd3, springCloudConfig
|
||||
*/
|
||||
private String type = "file";
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ConfigProperties setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.CONFIG_ZK_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = CONFIG_ZK_PREFIX)
|
||||
public class ConfigZooKeeperProperties {
|
||||
private String serverAddr = "127.0.0.1:2181";
|
||||
private long sessionTimeout = 6000L;
|
||||
private long connectTimeout = 2000L;
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
private String nodePath = "/seata/seata.properties";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getSessionTimeout() {
|
||||
return sessionTimeout;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setSessionTimeout(long sessionTimeout) {
|
||||
this.sessionTimeout = sessionTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getConnectTimeout() {
|
||||
return connectTimeout;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setConnectTimeout(long connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNodePath() {
|
||||
return nodePath;
|
||||
}
|
||||
|
||||
public ConfigZooKeeperProperties setNodePath(String nodePath) {
|
||||
this.nodePath = nodePath;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_LOAD_BALANCE;
|
||||
import static io.seata.common.DefaultValues.VIRTUAL_NODES_DEFAULT;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.LOAD_BALANCE_PREFIX_KEBAB_STYLE;
|
||||
|
||||
/**
|
||||
* @author ls9527
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = LOAD_BALANCE_PREFIX_KEBAB_STYLE)
|
||||
public class LoadBalanceProperties {
|
||||
/**
|
||||
* the load balance
|
||||
*/
|
||||
private String type = DEFAULT_LOAD_BALANCE;
|
||||
/**
|
||||
* the load balance virtual nodes
|
||||
*/
|
||||
private int virtualNodes = VIRTUAL_NODES_DEFAULT;
|
||||
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LoadBalanceProperties setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getVirtualNodes() {
|
||||
return virtualNodes;
|
||||
}
|
||||
|
||||
public LoadBalanceProperties setVirtualNodes(int virtualNodes) {
|
||||
this.virtualNodes = virtualNodes;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_CONSUL_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_CONSUL_PREFIX)
|
||||
public class RegistryConsulProperties {
|
||||
private String cluster = "default";
|
||||
private String serverAddr = "127.0.0.1:8500";
|
||||
private String aclToken = "";
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistryConsulProperties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistryConsulProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAclToken() {
|
||||
return aclToken;
|
||||
}
|
||||
|
||||
public RegistryConsulProperties setAclToken(String aclToken) {
|
||||
this.aclToken = aclToken;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_CUSTOM_PREFIX;
|
||||
|
||||
/**
|
||||
* @author jrial95@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_CUSTOM_PREFIX)
|
||||
public class RegistryCustomProperties {
|
||||
private String name = "";
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public RegistryCustomProperties setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_ETCD3_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_ETCD3_PREFIX)
|
||||
public class RegistryEtcd3Properties {
|
||||
private String cluster = "default";
|
||||
private String serverAddr = "http://localhost:2379";
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistryEtcd3Properties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistryEtcd3Properties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_EUREKA_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_EUREKA_PREFIX)
|
||||
public class RegistryEurekaProperties {
|
||||
private String serviceUrl = "http://localhost:8761/eureka";
|
||||
private String application = "default";
|
||||
private String weight = "1";
|
||||
|
||||
public String getServiceUrl() {
|
||||
return serviceUrl;
|
||||
}
|
||||
|
||||
public RegistryEurekaProperties setServiceUrl(String serviceUrl) {
|
||||
this.serviceUrl = serviceUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
||||
public RegistryEurekaProperties setApplication(String application) {
|
||||
this.application = application;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public RegistryEurekaProperties setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_NACOS_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_NACOS_PREFIX)
|
||||
public class RegistryNacosProperties {
|
||||
private String serverAddr = "localhost";
|
||||
private String namespace = "";
|
||||
private String group = "SEATA_GROUP";
|
||||
private String cluster = "default";
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
private String application = "seata-server";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
||||
public RegistryNacosProperties setApplication(String application) {
|
||||
this.application = application;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_PREFIX)
|
||||
public class RegistryProperties {
|
||||
/**
|
||||
* file, nacos, eureka, redis, zk, consul, etcd3, sofa
|
||||
*/
|
||||
private String type = "file";
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public RegistryProperties setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_REDIS_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_REDIS_PREFIX)
|
||||
public class RegistryRedisProperties {
|
||||
private String serverAddr = "localhost:6379";
|
||||
private int db = 0;
|
||||
private String password = "";
|
||||
private String cluster = "default";
|
||||
private int timeout = 0;
|
||||
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistryRedisProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDb() {
|
||||
return db;
|
||||
}
|
||||
|
||||
public RegistryRedisProperties setDb(int db) {
|
||||
this.db = db;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public RegistryRedisProperties setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistryRedisProperties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public RegistryRedisProperties setTimeout(int timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_SOFA_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_SOFA_PREFIX)
|
||||
public class RegistrySofaProperties {
|
||||
private String serverAddr = "127.0.0.1:9603";
|
||||
private String application = "default";
|
||||
private String region = "DEFAULT_ZONE";
|
||||
private String datacenter = "DefaultDataCenter";
|
||||
private String cluster = "default";
|
||||
private String group = "SEATA_GROUP";
|
||||
private String addressWaitTime = "3000";
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setApplication(String application) {
|
||||
this.application = application;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setRegion(String region) {
|
||||
this.region = region;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDatacenter() {
|
||||
return datacenter;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setDatacenter(String datacenter) {
|
||||
this.datacenter = datacenter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setGroup(String group) {
|
||||
this.group = group;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAddressWaitTime() {
|
||||
return addressWaitTime;
|
||||
}
|
||||
|
||||
public RegistrySofaProperties setAddressWaitTime(String addressWaitTime) {
|
||||
this.addressWaitTime = addressWaitTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.properties.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_ZK_PREFIX;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = REGISTRY_ZK_PREFIX)
|
||||
public class RegistryZooKeeperProperties {
|
||||
private String cluster = "default";
|
||||
private String serverAddr = "127.0.0.1:2181";
|
||||
private long sessionTimeout = 6000L;
|
||||
private long connectTimeout = 2000L;
|
||||
private String username = "";
|
||||
private String password = "";
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setCluster(String cluster) {
|
||||
this.cluster = cluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServerAddr() {
|
||||
return serverAddr;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setServerAddr(String serverAddr) {
|
||||
this.serverAddr = serverAddr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getSessionTimeout() {
|
||||
return sessionTimeout;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setSessionTimeout(long sessionTimeout) {
|
||||
this.sessionTimeout = sessionTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getConnectTimeout() {
|
||||
return connectTimeout;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setConnectTimeout(long connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public RegistryZooKeeperProperties setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure.provider;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import io.seata.common.exception.ShouldNeverHappenException;
|
||||
import io.seata.common.holder.ObjectHolder;
|
||||
import io.seata.config.Configuration;
|
||||
import io.seata.config.ExtConfigurationProvider;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.cglib.proxy.Enhancer;
|
||||
import org.springframework.cglib.proxy.MethodInterceptor;
|
||||
import org.springframework.cglib.proxy.MethodProxy;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import static io.seata.common.Constants.OBJECT_KEY_SPRING_APPLICATION_CONTEXT;
|
||||
import static io.seata.common.util.StringFormatUtils.DOT;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SEATA_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SERVICE_PREFIX;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SPECIAL_KEY_GROUPLIST;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.SPECIAL_KEY_VGROUP_MAPPING;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
public class SpringBootConfigurationProvider implements ExtConfigurationProvider {
|
||||
private static final String INTERCEPT_METHOD_PREFIX = "get";
|
||||
|
||||
@Override
|
||||
public Configuration provide(Configuration originalConfiguration) {
|
||||
return (Configuration) Enhancer.create(originalConfiguration.getClass(), new MethodInterceptor() {
|
||||
@Override
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy)
|
||||
throws Throwable {
|
||||
if (method.getName().startsWith(INTERCEPT_METHOD_PREFIX) && args.length > 0) {
|
||||
Object result = null;
|
||||
String rawDataId = (String) args[0];
|
||||
if (args.length == 1) {
|
||||
result = get(convertDataId(rawDataId));
|
||||
} else if (args.length == 2) {
|
||||
result = get(convertDataId(rawDataId), args[1]);
|
||||
} else if (args.length == 3) {
|
||||
result = get(convertDataId(rawDataId), args[1], (Long) args[2]);
|
||||
}
|
||||
if (result != null) {
|
||||
//If the return type is String,need to convert the object to string
|
||||
if (method.getReturnType().equals(String.class)) {
|
||||
return String.valueOf(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return method.invoke(originalConfiguration, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Object get(String dataId, Object defaultValue, long timeoutMills) throws IllegalAccessException, InstantiationException {
|
||||
return get(dataId, defaultValue);
|
||||
|
||||
}
|
||||
|
||||
private Object get(String dataId, Object defaultValue) throws IllegalAccessException, InstantiationException {
|
||||
Object result = get(dataId);
|
||||
if (result == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object get(String dataId) throws IllegalAccessException, InstantiationException {
|
||||
String propertyPrefix = getPropertyPrefix(dataId);
|
||||
String propertySuffix = getPropertySuffix(dataId);
|
||||
ApplicationContext applicationContext = (ApplicationContext) ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_APPLICATION_CONTEXT);
|
||||
Class<?> propertyClass = PROPERTY_BEAN_MAP.get(propertyPrefix);
|
||||
Object valueObject = null;
|
||||
if (propertyClass != null) {
|
||||
try {
|
||||
Object propertyBean = applicationContext.getBean(propertyClass);
|
||||
valueObject = getFieldValue(propertyBean, propertySuffix, dataId);
|
||||
} catch (NoSuchBeanDefinitionException ignore) {
|
||||
|
||||
}
|
||||
} else {
|
||||
throw new ShouldNeverHappenException("PropertyClass for prefix: [" + propertyPrefix + "] should not be null.");
|
||||
}
|
||||
if (valueObject == null) {
|
||||
valueObject = getFieldValue(propertyClass.newInstance(), propertySuffix, dataId);
|
||||
}
|
||||
|
||||
return valueObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* get field value
|
||||
*
|
||||
* @param object
|
||||
* @param fieldName
|
||||
* @param dataId
|
||||
* @return java.lang.Object
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
private Object getFieldValue(Object object, String fieldName, String dataId) throws IllegalAccessException {
|
||||
Object value = null;
|
||||
Optional<Field> fieldOptional = Stream.of(object.getClass().getDeclaredFields()).filter(
|
||||
f -> f.getName().equalsIgnoreCase(fieldName)).findAny();
|
||||
if (fieldOptional.isPresent()) {
|
||||
Field field = fieldOptional.get();
|
||||
field.setAccessible(true);
|
||||
value = field.get(object);
|
||||
if (value instanceof Map) {
|
||||
String key = StringUtils.substringAfterLast(dataId, String.valueOf(DOT));
|
||||
value = ((Map) value).get(key);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert data id
|
||||
*
|
||||
* @param rawDataId
|
||||
* @return dataId
|
||||
*/
|
||||
private String convertDataId(String rawDataId) {
|
||||
if (rawDataId.endsWith(SPECIAL_KEY_GROUPLIST)) {
|
||||
String suffix = StringUtils.removeEnd(rawDataId, DOT + SPECIAL_KEY_GROUPLIST);
|
||||
//change the format of default.grouplist to grouplist.default
|
||||
return SERVICE_PREFIX + DOT + SPECIAL_KEY_GROUPLIST + DOT + suffix;
|
||||
}
|
||||
return SEATA_PREFIX + DOT + rawDataId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get property prefix
|
||||
*
|
||||
* @param dataId
|
||||
* @return propertyPrefix
|
||||
*/
|
||||
private String getPropertyPrefix(String dataId) {
|
||||
if (dataId.contains(SPECIAL_KEY_VGROUP_MAPPING)) {
|
||||
return SERVICE_PREFIX;
|
||||
}
|
||||
if (dataId.contains(SPECIAL_KEY_GROUPLIST)) {
|
||||
return SERVICE_PREFIX;
|
||||
}
|
||||
return StringUtils.substringBeforeLast(dataId, String.valueOf(DOT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get property suffix
|
||||
*
|
||||
* @param dataId
|
||||
* @return propertySuffix
|
||||
*/
|
||||
private String getPropertySuffix(String dataId) {
|
||||
if (dataId.contains(SPECIAL_KEY_VGROUP_MAPPING)) {
|
||||
return SPECIAL_KEY_VGROUP_MAPPING;
|
||||
}
|
||||
if (dataId.contains(SPECIAL_KEY_GROUPLIST)) {
|
||||
return SPECIAL_KEY_GROUPLIST;
|
||||
}
|
||||
return StringUtils.substringAfterLast(dataId, String.valueOf(DOT));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
{
|
||||
"groups": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.cloud.alibaba.seata.application-id",
|
||||
"type": "java.lang.String",
|
||||
"description": "The application id, default value if '${spring.application.name}'.",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.SpringCloudAlibabaConfiguration",
|
||||
"defaultValue": "${spring.application.name:}",
|
||||
"deprecation": {
|
||||
"level": "warning",
|
||||
"replacement": "seata.application-id",
|
||||
"reason": "It may be removed in a future release, please configure to 'seata.application-id'."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spring.cloud.alibaba.seata.tx-service-group",
|
||||
"type": "java.lang.String",
|
||||
"description": "The tx-service-group.",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.SpringCloudAlibabaConfiguration",
|
||||
"deprecation": {
|
||||
"level": "warning",
|
||||
"replacement": "seata.tx-service-group",
|
||||
"reason": "It may be removed in a future release, please configure to 'seata.tx-service-group'."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seata.application-id",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.SeataProperties",
|
||||
"defaultValue": "${spring.application.name:}"
|
||||
},
|
||||
{
|
||||
"name": "seata.data-source-proxy-mode",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.SeataProperties",
|
||||
"defaultValue": "AT"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.async-commit-buffer-limit",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": 10000
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.report-retry-count",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": 5
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.table-meta-check-enable",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.report-success-enable",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.saga-branch-register-enable",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.saga-json-parser",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": "fastjson"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.saga-retry-persist-mode-update",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.saga-compensate-persist-mode-update",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.RmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.lock.retry-interval",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LockProperties",
|
||||
"defaultValue": 10
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.lock.retry-times",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LockProperties",
|
||||
"defaultValue": 30
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.lock.retry-policy-branch-rollback-on-conflict",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LockProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.commit-retry-count",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": 5
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.rollback-retry-count",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": 5
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.default-global-transaction-timeout",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": 60000
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.degrade-check",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.degrade-check-period",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": 2000
|
||||
},
|
||||
{
|
||||
"name": "seata.client.tm.degrade-check-allow-times",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TmProperties",
|
||||
"defaultValue": 10
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.data-validation",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.log-serialization",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoProperties",
|
||||
"defaultValue": "jackson"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.log-table",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoProperties",
|
||||
"defaultValue": "undo_log"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.only-care-update-columns",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.compress.enable",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoCompressProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.compress.type",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoCompressProperties",
|
||||
"defaultValue": "zip"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.compress.threshold",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoCompressProperties",
|
||||
"defaultValue": "64k"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.log.exception-rate",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LogProperties",
|
||||
"deprecation": {
|
||||
"level": "error",
|
||||
"replacement": "seata.log.exception-rate",
|
||||
"reason": "Please configure to 'seata.log.exception-rate'."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seata.log.exception-rate",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LogProperties",
|
||||
"defaultValue": 100
|
||||
},
|
||||
{
|
||||
"name": "seata.service.disable-global-transaction",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ServiceProperties",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.heartbeat",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TransportProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.enable-client-batch-send-request",
|
||||
"type": "java.lang.Boolean",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.TransportProperties",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.shutdown.wait",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ShutdownProperties",
|
||||
"defaultValue": 3
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.boss-thread-prefix",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "NettyBoss"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.worker-thread-prefix",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "NettyServerNIOWorker"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.server-executor-thread-prefix",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "NettyServerBizHandler"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.client-selector-thread-prefix",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "NettyClientSelector"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.client-selector-thread-size",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": 1
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.client-worker-thread-prefix",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "NettyClientWorkerThread"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.worker-thread-size",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": "Default"
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.boss-thread-size",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties",
|
||||
"defaultValue": 1
|
||||
},
|
||||
{
|
||||
"name": "seata.registry.load-balance",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.registry.RegistryProperties",
|
||||
"defaultValue": "RandomLoadBalance",
|
||||
"deprecation": {
|
||||
"level": "error",
|
||||
"replacement": "seata.client.load-balance.type",
|
||||
"reason": "Please configure to 'seata.client.load-balance.type'."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seata.registry.load-balance-virtual-nodes",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.registry.RegistryProperties",
|
||||
"defaultValue": 10,
|
||||
"deprecation": {
|
||||
"level": "error",
|
||||
"replacement": "seata.client.load-balance.virtual-nodes",
|
||||
"reason": "Please configure to 'seata.client.load-balance.virtual-nodes'."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seata.client.load-balance.type",
|
||||
"type": "java.lang.String",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.registry.LoadBalanceProperties",
|
||||
"defaultValue": "RandomLoadBalance"
|
||||
},
|
||||
{
|
||||
"name": "seata.client.load-balance.virtual-nodes",
|
||||
"type": "java.lang.Integer",
|
||||
"sourceType": "io.seata.spring.boot.autoconfigure.properties.registry.LoadBalanceProperties",
|
||||
"defaultValue": 10
|
||||
}
|
||||
],
|
||||
"hints": [
|
||||
{
|
||||
"name": "seata.config.type",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.config.ConfigType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.registry.type",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.discovery.registry.RegistryType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.client.load-balance.type",
|
||||
"values": [
|
||||
{
|
||||
"value": "RandomLoadBalance",
|
||||
"description": "the default load balance."
|
||||
},
|
||||
{
|
||||
"value": "ConsistentHashLoadBalance"
|
||||
},
|
||||
{
|
||||
"value": "RoundRobinLoadBalance"
|
||||
},
|
||||
{
|
||||
"value": "LeastActiveLoadBalance"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.data-source-proxy-mode",
|
||||
"values": [
|
||||
{
|
||||
"value": "AT",
|
||||
"description": "the default mode."
|
||||
},
|
||||
{
|
||||
"value": "XA"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.excludes-for-auto-proxying",
|
||||
"providers": [
|
||||
{
|
||||
"name": "class-reference",
|
||||
"parameters": {
|
||||
"target": "javax.sql.DataSource"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.client.rm.saga-json-parser",
|
||||
"values": [
|
||||
{
|
||||
"value": "fastjson",
|
||||
"description": "the default parser."
|
||||
},
|
||||
{
|
||||
"value": "jackson"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.log-serialization",
|
||||
"values": [
|
||||
{
|
||||
"value": "jackson",
|
||||
"description": "the default serialization."
|
||||
},
|
||||
{
|
||||
"value": "fastjson"
|
||||
},
|
||||
{
|
||||
"value": "kryo"
|
||||
},
|
||||
{
|
||||
"value": "protostuff"
|
||||
},
|
||||
{
|
||||
"value": "fst"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.type",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.rpc.TransportProtocolType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.server",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.rpc.TransportServerType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.serialization",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.serializer.SerializerType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.compressor",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.compressor.CompressorType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.client.undo.compress.type",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.compressor.CompressorType"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seata.transport.thread-factory.worker-thread-size",
|
||||
"providers": [
|
||||
{
|
||||
"name": "handle-as",
|
||||
"parameters": {
|
||||
"target": "io.seata.core.rpc.netty.NettyBaseConfig$WorkThreadMode"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider
|
||||
@@ -0,0 +1,6 @@
|
||||
# Auto Configure
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
io.seata.spring.boot.autoconfigure.SeataPropertiesAutoConfiguration,\
|
||||
io.seata.spring.boot.autoconfigure.SeataDataSourceAutoConfiguration,\
|
||||
io.seata.spring.boot.autoconfigure.SeataAutoConfiguration,\
|
||||
io.seata.spring.boot.autoconfigure.HttpAutoConfiguration
|
||||
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.SpringCloudAlibabaConfiguration;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.LockProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.LogProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.RmProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ServiceProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ShutdownProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.ThreadFactoryProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.TmProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.TransportProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.client.UndoProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigApolloProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigConsulProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigCustomProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigEtcd3Properties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigFileProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigNacosProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.config.ConfigZooKeeperProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.LoadBalanceProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryConsulProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryCustomProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryEtcd3Properties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryEurekaProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryNacosProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryRedisProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistrySofaProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryZooKeeperProperties;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static io.seata.common.DefaultValues.DEFAULT_GLOBAL_TRANSACTION_TIMEOUT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_COMMIT_RETRY_COUNT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TM_ROLLBACK_RETRY_COUNT;
|
||||
import static io.seata.common.DefaultValues.DEFAULT_TRANSACTION_UNDO_LOG_TABLE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
public class PropertiesTest {
|
||||
private static AnnotationConfigApplicationContext context;
|
||||
|
||||
@BeforeAll
|
||||
public static void initContext() {
|
||||
context = new AnnotationConfigApplicationContext("io.seata.spring.boot.autoconfigure.properties");
|
||||
context.registerBeanDefinition("springCloudAlibabaConfiguration", BeanDefinitionBuilder.genericBeanDefinition(SpringCloudAlibabaConfiguration.class).getBeanDefinition());
|
||||
context.registerBeanDefinition("seataProperties", BeanDefinitionBuilder.genericBeanDefinition(SeataProperties.class).getBeanDefinition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLockProperties() {
|
||||
assertEquals(10, context.getBean(LockProperties.class).getRetryInterval());
|
||||
assertEquals(30, context.getBean(LockProperties.class).getRetryTimes());
|
||||
assertTrue(context.getBean(LockProperties.class).isRetryPolicyBranchRollbackOnConflict());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogProperties() {
|
||||
assertEquals(100, context.getBean(LogProperties.class).getExceptionRate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRmProperties() {
|
||||
assertEquals(10000, context.getBean(RmProperties.class).getAsyncCommitBufferLimit());
|
||||
assertEquals(5, context.getBean(RmProperties.class).getReportRetryCount());
|
||||
assertFalse(context.getBean(RmProperties.class).isTableMetaCheckEnable());
|
||||
assertFalse(context.getBean(RmProperties.class).isReportSuccessEnable());
|
||||
assertEquals(60000L,context.getBean(RmProperties.class).getTableMetaCheckerInterval());
|
||||
assertFalse(context.getBean(RmProperties.class).isSagaRetryPersistModeUpdate());
|
||||
assertFalse(context.getBean(RmProperties.class).isSagaCompensatePersistModeUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServiceProperties() {
|
||||
ServiceProperties serviceProperties = context.getBean(ServiceProperties.class);
|
||||
Map<String, String> vgroupMapping = serviceProperties.getVgroupMapping();
|
||||
Map<String, String> grouplist = serviceProperties.getGrouplist();
|
||||
assertEquals("default", vgroupMapping.get("my_test_tx_group"));
|
||||
assertEquals("127.0.0.1:8091", grouplist.get("default"));
|
||||
assertFalse(serviceProperties.isEnableDegrade());
|
||||
assertFalse(serviceProperties.isDisableGlobalTransaction());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShutdownProperties() {
|
||||
assertEquals(3L, context.getBean(ShutdownProperties.class).getWait());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThreadFactoryProperties() {
|
||||
assertEquals("NettyBoss", context.getBean(ThreadFactoryProperties.class).getBossThreadPrefix());
|
||||
assertEquals("NettyServerNIOWorker", context.getBean(ThreadFactoryProperties.class).getWorkerThreadPrefix());
|
||||
assertEquals("NettyServerBizHandler", context.getBean(ThreadFactoryProperties.class).getServerExecutorThreadPrefix());
|
||||
assertFalse(context.getBean(ThreadFactoryProperties.class).isShareBossWorker());
|
||||
assertEquals("NettyClientSelector", context.getBean(ThreadFactoryProperties.class).getClientSelectorThreadPrefix());
|
||||
assertEquals(1, context.getBean(ThreadFactoryProperties.class).getClientSelectorThreadSize());
|
||||
assertEquals("NettyClientWorkerThread", context.getBean(ThreadFactoryProperties.class).getClientWorkerThreadPrefix());
|
||||
assertEquals(1, context.getBean(ThreadFactoryProperties.class).getBossThreadSize());
|
||||
assertEquals("Default", context.getBean(ThreadFactoryProperties.class).getWorkerThreadSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTmProperties() {
|
||||
assertEquals(DEFAULT_TM_COMMIT_RETRY_COUNT, context.getBean(TmProperties.class).getCommitRetryCount());
|
||||
assertEquals(DEFAULT_TM_ROLLBACK_RETRY_COUNT, context.getBean(TmProperties.class).getRollbackRetryCount());
|
||||
assertEquals(DEFAULT_GLOBAL_TRANSACTION_TIMEOUT, context.getBean(TmProperties.class).getDefaultGlobalTransactionTimeout());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransportProperties() {
|
||||
assertEquals("TCP", context.getBean(TransportProperties.class).getType());
|
||||
assertEquals("NIO", context.getBean(TransportProperties.class).getServer());
|
||||
assertTrue(context.getBean(TransportProperties.class).isHeartbeat());
|
||||
assertEquals("seata", context.getBean(TransportProperties.class).getSerialization());
|
||||
assertEquals("none", context.getBean(TransportProperties.class).getCompressor());
|
||||
assertTrue(context.getBean(TransportProperties.class).isEnableClientBatchSendRequest());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUndoProperties() {
|
||||
assertTrue(context.getBean(UndoProperties.class).isDataValidation());
|
||||
assertEquals("jackson", context.getBean(UndoProperties.class).getLogSerialization());
|
||||
assertEquals(DEFAULT_TRANSACTION_UNDO_LOG_TABLE, context.getBean(UndoProperties.class).getLogTable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigApolloProperties() {
|
||||
assertEquals("seata-server", context.getBean(ConfigApolloProperties.class).getAppId());
|
||||
assertEquals("http://192.168.1.204:8801", context.getBean(ConfigApolloProperties.class).getApolloMeta());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigConsulProperties() {
|
||||
assertEquals("127.0.0.1:8500", context.getBean(ConfigConsulProperties.class).getServerAddr());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigEtcd3Properties() {
|
||||
assertEquals("http://localhost:2379", context.getBean(ConfigEtcd3Properties.class).getServerAddr());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigFileProperties() {
|
||||
assertEquals("file.conf", context.getBean(ConfigFileProperties.class).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigNacosProperties() {
|
||||
assertEquals("localhost", context.getBean(ConfigNacosProperties.class).getServerAddr());
|
||||
assertEquals("", context.getBean(ConfigNacosProperties.class).getNamespace());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigProperties() {
|
||||
assertEquals("file", context.getBean(ConfigProperties.class).getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigZooKeeperProperties() {
|
||||
assertEquals("127.0.0.1:2181", context.getBean(ConfigZooKeeperProperties.class).getServerAddr());
|
||||
assertEquals(6000L, context.getBean(ConfigZooKeeperProperties.class).getSessionTimeout());
|
||||
assertEquals(2000L, context.getBean(ConfigZooKeeperProperties.class).getConnectTimeout());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigCustomProperties() {
|
||||
assertEquals("", context.getBean(ConfigCustomProperties.class).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryConsulProperties() {
|
||||
assertEquals("default", context.getBean(RegistryConsulProperties.class).getCluster());
|
||||
assertEquals("127.0.0.1:8500", context.getBean(RegistryConsulProperties.class).getServerAddr());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryEtcd3Properties() {
|
||||
assertEquals("default", context.getBean(RegistryEtcd3Properties.class).getCluster());
|
||||
assertEquals("http://localhost:2379", context.getBean(RegistryEtcd3Properties.class).getServerAddr());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryEurekaProperties() {
|
||||
assertEquals("default", context.getBean(RegistryEurekaProperties.class).getApplication());
|
||||
assertEquals("http://localhost:8761/eureka", context.getBean(RegistryEurekaProperties.class).getServiceUrl());
|
||||
assertEquals("1", context.getBean(RegistryEurekaProperties.class).getWeight());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryNacosProperties() {
|
||||
assertEquals("localhost", context.getBean(RegistryNacosProperties.class).getServerAddr());
|
||||
assertEquals("", context.getBean(RegistryNacosProperties.class).getNamespace());
|
||||
assertEquals("SEATA_GROUP", context.getBean(RegistryNacosProperties.class).getGroup());
|
||||
assertEquals("default", context.getBean(RegistryNacosProperties.class).getCluster());
|
||||
assertEquals("", context.getBean(RegistryNacosProperties.class).getUsername());
|
||||
assertEquals("", context.getBean(RegistryNacosProperties.class).getPassword());
|
||||
assertEquals("seata-server", context.getBean(RegistryNacosProperties.class).getApplication());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryProperties() {
|
||||
assertEquals("file", context.getBean(RegistryProperties.class).getType());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLoadBalanceProperties() {
|
||||
assertEquals("RandomLoadBalance", context.getBean(LoadBalanceProperties.class).getType());
|
||||
assertEquals(10, context.getBean(LoadBalanceProperties.class).getVirtualNodes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryRedisProperties() {
|
||||
assertEquals("localhost:6379", context.getBean(RegistryRedisProperties.class).getServerAddr());
|
||||
assertEquals(0, context.getBean(RegistryRedisProperties.class).getDb());
|
||||
assertEquals("", context.getBean(RegistryRedisProperties.class).getPassword());
|
||||
assertEquals("default", context.getBean(RegistryRedisProperties.class).getCluster());
|
||||
assertEquals(0, context.getBean(RegistryRedisProperties.class).getTimeout());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrySofaProperties() {
|
||||
assertEquals("127.0.0.1:9603", context.getBean(RegistrySofaProperties.class).getServerAddr());
|
||||
assertEquals("default", context.getBean(RegistrySofaProperties.class).getApplication());
|
||||
assertEquals("DEFAULT_ZONE", context.getBean(RegistrySofaProperties.class).getRegion());
|
||||
assertEquals("DefaultDataCenter", context.getBean(RegistrySofaProperties.class).getDatacenter());
|
||||
assertEquals("default", context.getBean(RegistrySofaProperties.class).getCluster());
|
||||
assertEquals("SEATA_GROUP", context.getBean(RegistrySofaProperties.class).getGroup());
|
||||
assertEquals("3000", context.getBean(RegistrySofaProperties.class).getAddressWaitTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryZooKeeperProperties() {
|
||||
assertEquals("default", context.getBean(RegistryZooKeeperProperties.class).getCluster());
|
||||
assertEquals("127.0.0.1:2181", context.getBean(RegistryZooKeeperProperties.class).getServerAddr());
|
||||
assertEquals(6000L, context.getBean(RegistryZooKeeperProperties.class).getSessionTimeout());
|
||||
assertEquals(2000L, context.getBean(RegistryZooKeeperProperties.class).getConnectTimeout());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryCustomProperties() {
|
||||
assertEquals("", context.getBean(RegistryCustomProperties.class).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeataProperties() {
|
||||
assertTrue(context.getBean(SeataProperties.class).isEnabled());
|
||||
assertNull(context.getBean(SeataProperties.class).getApplicationId());
|
||||
assertEquals("null-seata-service-group", context.getBean(SeataProperties.class).getTxServiceGroup());
|
||||
assertTrue(context.getBean(SeataProperties.class).isEnableAutoDataSourceProxy());
|
||||
assertEquals("AT", context.getBean(SeataProperties.class).getDataSourceProxyMode());
|
||||
assertFalse(context.getBean(SeataProperties.class).isUseJdkProxy());
|
||||
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void closeContext() {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties;
|
||||
import io.seata.spring.boot.autoconfigure.properties.SpringCloudAlibabaConfiguration;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author xingfudeshi@gmail.com
|
||||
*/
|
||||
@Configuration
|
||||
public class PropertyBeanPostProcessorTest {
|
||||
private static AnnotationConfigApplicationContext context;
|
||||
|
||||
@BeforeAll
|
||||
public static void initContext() {
|
||||
context = new AnnotationConfigApplicationContext(PropertyBeanPostProcessorTest.class);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public SeataProperties seataProperties() {
|
||||
SeataProperties seataProperties = new SeataProperties();
|
||||
seataProperties.setApplicationId("test-id");
|
||||
return seataProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SpringCloudAlibabaConfiguration springCloudAlibabaConfiguration() {
|
||||
return new SpringCloudAlibabaConfiguration();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void closeContext() {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.spring.boot.autoconfigure;
|
||||
|
||||
import io.seata.common.loader.EnhancedServiceLoader;
|
||||
import io.seata.config.Configuration;
|
||||
import io.seata.config.ExtConfigurationProvider;
|
||||
import io.seata.config.FileConfiguration;
|
||||
import io.seata.config.springcloud.SpringApplicationContextProvider;
|
||||
import io.seata.spring.boot.autoconfigure.properties.registry.RegistryRedisProperties;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP;
|
||||
import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_REDIS_PREFIX;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* @author zhangheng
|
||||
**/
|
||||
@Import(SpringApplicationContextProvider.class)
|
||||
@org.springframework.context.annotation.Configuration
|
||||
public class RedisAutoInjectionTypeConvertTest {
|
||||
private static AnnotationConfigApplicationContext applicationContex;
|
||||
|
||||
@BeforeAll
|
||||
public static void initContext() {
|
||||
applicationContex = new AnnotationConfigApplicationContext(RedisAutoInjectionTypeConvertTest.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
RegistryRedisProperties registryRedisProperties() {
|
||||
RegistryRedisProperties registryRedisProperties = new RegistryRedisProperties().setPassword("123456").setDb(1).setServerAddr("localhost:123456");
|
||||
PROPERTY_BEAN_MAP.put(REGISTRY_REDIS_PREFIX, RegistryRedisProperties.class);
|
||||
return registryRedisProperties;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadConfigurationItems() {
|
||||
FileConfiguration configuration = mock(FileConfiguration.class);
|
||||
Configuration currentConfiguration =
|
||||
EnhancedServiceLoader.load(ExtConfigurationProvider.class).provide(configuration);
|
||||
assertEquals(1, currentConfiguration.getInt("registry.redis.db"));
|
||||
assertEquals("123456", currentConfiguration.getConfig("registry.redis.password"));
|
||||
assertEquals("localhost:123456", currentConfiguration.getConfig("registry.redis.serverAddr"));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void closeContext() {
|
||||
applicationContex.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user