mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync code from master branch
This commit is contained in:
parent
7e35e71119
commit
fa71593248
@ -171,26 +171,11 @@
|
|||||||
|
|
||||||
<!--Alibaba Fescar-->
|
<!--Alibaba Fescar-->
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-core</artifactId>
|
|
||||||
<version>${fescar.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-common</artifactId>
|
|
||||||
<version>${fescar.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
<groupId>com.alibaba.fescar</groupId>
|
||||||
<artifactId>fescar-spring</artifactId>
|
<artifactId>fescar-spring</artifactId>
|
||||||
<version>${fescar.version}</version>
|
<version>${fescar.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-rm-datasource</artifactId>
|
|
||||||
<version>${fescar.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Aliyun OSS dependencies -->
|
<!-- Aliyun OSS dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>1.5.16.RELEASE</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>alibaba.com</groupId>
|
|
||||||
<artifactId>env-extension</artifactId>
|
|
||||||
<version>0.1.2.BUILD-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>env-extension</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!--Spring Boot -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,11 +0,0 @@
|
|||||||
package org.springframework.alicloud.env.extension;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
public @interface ImportExtraConfig {
|
|
||||||
|
|
||||||
String[] name() default "";
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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 org.springframework.alicloud.env.extension;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.core.env.PropertiesPropertySource;
|
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author pbting
|
|
||||||
* @date 2019-01-09 7:39 PM
|
|
||||||
*/
|
|
||||||
public class LoadExtraConfigApplicationListener
|
|
||||||
implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
|
|
||||||
SpringApplication springApplication = event.getSpringApplication();
|
|
||||||
Class clazz = springApplication.getMainApplicationClass();
|
|
||||||
if (!clazz.isAnnotationPresent(ImportExtraConfig.class)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ImportExtraConfig annotation = (ImportExtraConfig) clazz
|
|
||||||
.getAnnotation(ImportExtraConfig.class);
|
|
||||||
|
|
||||||
String[] extraConfig = annotation.name();
|
|
||||||
|
|
||||||
if (extraConfig == null || extraConfig.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String config : extraConfig) {
|
|
||||||
try {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.load(new FileInputStream(config));
|
|
||||||
event.getEnvironment().getPropertySources()
|
|
||||||
.addFirst(new PropertiesPropertySource(config, properties));
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
org.springframework.context.ApplicationListener=\
|
|
||||||
org.springframework.alicloud.env.extension.LoadExtraConfigApplicationListener
|
|
@ -34,30 +34,4 @@
|
|||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<inherited>false</inherited>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
@ -53,7 +53,7 @@ public class DatabaseConfiguration {
|
|||||||
String password = environment.getProperty("mysql.user.password");
|
String password = environment.getProperty("mysql.user.password");
|
||||||
|
|
||||||
DruidDataSource druidDataSource = new DruidDataSource();
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
|
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
|
||||||
druidDataSource.setUsername(userName);
|
druidDataSource.setUsername(userName);
|
||||||
druidDataSource.setPassword(password);
|
druidDataSource.setPassword(password);
|
||||||
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
|
@ -5,5 +5,5 @@ mysql.server.ip=127.0.0.1
|
|||||||
mysql.server.port=3306
|
mysql.server.port=3306
|
||||||
mysql.db.name=demo
|
mysql.db.name=demo
|
||||||
|
|
||||||
mysql.user.name=xxxxx
|
mysql.user.name=root
|
||||||
mysql.user.password=xxxxx
|
mysql.user.password=123456
|
@ -3,6 +3,8 @@ transport {
|
|||||||
type = "TCP"
|
type = "TCP"
|
||||||
#NIO NATIVE
|
#NIO NATIVE
|
||||||
server = "NIO"
|
server = "NIO"
|
||||||
|
#enable heartbeat
|
||||||
|
heartbeat = true
|
||||||
#thread factory for netty
|
#thread factory for netty
|
||||||
thread-factory {
|
thread-factory {
|
||||||
boss-thread-prefix = "NettyBoss"
|
boss-thread-prefix = "NettyBoss"
|
||||||
@ -28,3 +30,11 @@ service {
|
|||||||
#disable
|
#disable
|
||||||
disable = false
|
disable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
async.commit.buffer.limit = 10000
|
||||||
|
lock {
|
||||||
|
retry.internal = 10
|
||||||
|
retry.times = 30
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
registry {
|
||||||
|
# file 、nacos 、redis
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
redis {
|
||||||
|
serverAddr = "localhost:6379"
|
||||||
|
db = "0"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config {
|
||||||
|
# file nacos apollo
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
apollo {
|
||||||
|
app.id = "fescar-server"
|
||||||
|
apollo.meta = "http://192.168.1.204:8801"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
@ -38,25 +38,4 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<inherited>false</inherited>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
@ -3,6 +3,8 @@ transport {
|
|||||||
type = "TCP"
|
type = "TCP"
|
||||||
#NIO NATIVE
|
#NIO NATIVE
|
||||||
server = "NIO"
|
server = "NIO"
|
||||||
|
#enable heartbeat
|
||||||
|
heartbeat = true
|
||||||
#thread factory for netty
|
#thread factory for netty
|
||||||
thread-factory {
|
thread-factory {
|
||||||
boss-thread-prefix = "NettyBoss"
|
boss-thread-prefix = "NettyBoss"
|
||||||
@ -28,3 +30,11 @@ service {
|
|||||||
#disable
|
#disable
|
||||||
disable = false
|
disable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
async.commit.buffer.limit = 10000
|
||||||
|
lock {
|
||||||
|
retry.internal = 10
|
||||||
|
retry.times = 30
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
registry {
|
||||||
|
# file 、nacos 、redis
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
redis {
|
||||||
|
serverAddr = "localhost:6379"
|
||||||
|
db = "0"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config {
|
||||||
|
# file nacos apollo
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
apollo {
|
||||||
|
app.id = "fescar-server"
|
||||||
|
apollo.meta = "http://192.168.1.204:8801"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
@ -35,29 +35,5 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<inherited>false</inherited>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
@ -53,7 +53,8 @@ public class DatabaseConfiguration {
|
|||||||
String password = env.getProperty("mysql.user.password");
|
String password = env.getProperty("mysql.user.password");
|
||||||
|
|
||||||
DruidDataSource druidDataSource = new DruidDataSource();
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
|
druidDataSource.setUrl(
|
||||||
|
"jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
|
||||||
druidDataSource.setUsername(userName);
|
druidDataSource.setUsername(userName);
|
||||||
druidDataSource.setPassword(password);
|
druidDataSource.setPassword(password);
|
||||||
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
|
@ -16,11 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.cloud.examples;
|
package org.springframework.cloud.alibaba.cloud.examples;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.alibaba.fescar.core.context.RootContext;
|
import com.alibaba.fescar.core.context.RootContext;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -40,6 +35,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiaojing
|
* @author xiaojing
|
||||||
*/
|
*/
|
||||||
@ -94,7 +94,7 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
}, keyHolder);
|
}, keyHolder);
|
||||||
|
|
||||||
order.id = (long) keyHolder.getKey();
|
order.id = keyHolder.getKey().longValue();
|
||||||
|
|
||||||
if (random.nextBoolean()) {
|
if (random.nextBoolean()) {
|
||||||
throw new RuntimeException("this is a mock Exception");
|
throw new RuntimeException("this is a mock Exception");
|
||||||
|
@ -5,5 +5,5 @@ mysql.server.ip=127.0.0.1
|
|||||||
mysql.server.port=3306
|
mysql.server.port=3306
|
||||||
mysql.db.name=demo
|
mysql.db.name=demo
|
||||||
|
|
||||||
mysql.user.name=xxxxx
|
mysql.user.name=root
|
||||||
mysql.user.password=xxxxx
|
mysql.user.password=123456
|
@ -3,6 +3,8 @@ transport {
|
|||||||
type = "TCP"
|
type = "TCP"
|
||||||
#NIO NATIVE
|
#NIO NATIVE
|
||||||
server = "NIO"
|
server = "NIO"
|
||||||
|
#enable heartbeat
|
||||||
|
heartbeat = true
|
||||||
#thread factory for netty
|
#thread factory for netty
|
||||||
thread-factory {
|
thread-factory {
|
||||||
boss-thread-prefix = "NettyBoss"
|
boss-thread-prefix = "NettyBoss"
|
||||||
@ -28,3 +30,11 @@ service {
|
|||||||
#disable
|
#disable
|
||||||
disable = false
|
disable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
async.commit.buffer.limit = 10000
|
||||||
|
lock {
|
||||||
|
retry.internal = 10
|
||||||
|
retry.times = 30
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
registry {
|
||||||
|
# file 、nacos 、redis
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
redis {
|
||||||
|
serverAddr = "localhost:6379"
|
||||||
|
db = "0"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config {
|
||||||
|
# file nacos apollo
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
apollo {
|
||||||
|
app.id = "fescar-server"
|
||||||
|
apollo.meta = "http://192.168.1.204:8801"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
@ -39,30 +39,4 @@
|
|||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<inherited>false</inherited>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
<check/>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
@ -54,7 +54,7 @@ public class DatabaseConfiguration {
|
|||||||
String password = environment.getProperty("mysql.user.password");
|
String password = environment.getProperty("mysql.user.password");
|
||||||
|
|
||||||
DruidDataSource druidDataSource = new DruidDataSource();
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
|
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
|
||||||
druidDataSource.setUsername(userName);
|
druidDataSource.setUsername(userName);
|
||||||
druidDataSource.setPassword(password);
|
druidDataSource.setPassword(password);
|
||||||
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
|
@ -5,5 +5,5 @@ mysql.server.ip=127.0.0.1
|
|||||||
mysql.server.port=3306
|
mysql.server.port=3306
|
||||||
mysql.db.name=demo
|
mysql.db.name=demo
|
||||||
|
|
||||||
mysql.user.name=xxxxx
|
mysql.user.name=root
|
||||||
mysql.user.password=xxxxx
|
mysql.user.password=123456
|
@ -3,6 +3,8 @@ transport {
|
|||||||
type = "TCP"
|
type = "TCP"
|
||||||
#NIO NATIVE
|
#NIO NATIVE
|
||||||
server = "NIO"
|
server = "NIO"
|
||||||
|
#enable heartbeat
|
||||||
|
heartbeat = true
|
||||||
#thread factory for netty
|
#thread factory for netty
|
||||||
thread-factory {
|
thread-factory {
|
||||||
boss-thread-prefix = "NettyBoss"
|
boss-thread-prefix = "NettyBoss"
|
||||||
@ -28,3 +30,11 @@ service {
|
|||||||
#disable
|
#disable
|
||||||
disable = false
|
disable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
async.commit.buffer.limit = 10000
|
||||||
|
lock {
|
||||||
|
retry.internal = 10
|
||||||
|
retry.times = 30
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
registry {
|
||||||
|
# file 、nacos 、redis
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
redis {
|
||||||
|
serverAddr = "localhost:6379"
|
||||||
|
db = "0"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config {
|
||||||
|
# file nacos apollo
|
||||||
|
type = "file"
|
||||||
|
|
||||||
|
nacos {
|
||||||
|
serverAddr = "localhost"
|
||||||
|
namespace = "public"
|
||||||
|
cluster = "default"
|
||||||
|
}
|
||||||
|
apollo {
|
||||||
|
app.id = "fescar-server"
|
||||||
|
apollo.meta = "http://192.168.1.204:8801"
|
||||||
|
}
|
||||||
|
file {
|
||||||
|
name = "file.conf"
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,6 @@
|
|||||||
<module>acm-example/acm-local-example</module>
|
<module>acm-example/acm-local-example</module>
|
||||||
<module>rocketmq-example/rocketmq-consume-example</module>
|
<module>rocketmq-example/rocketmq-consume-example</module>
|
||||||
<module>rocketmq-example/rocketmq-produce-example</module>
|
<module>rocketmq-example/rocketmq-produce-example</module>
|
||||||
<module>env-extension</module>
|
|
||||||
<module>sms-example</module>
|
<module>sms-example</module>
|
||||||
<module>spring-cloud-bus-rocketmq-example</module>
|
<module>spring-cloud-bus-rocketmq-example</module>
|
||||||
<module>schedulerx-example/schedulerx-simple-task-example</module>
|
<module>schedulerx-example/schedulerx-simple-task-example</module>
|
||||||
|
@ -15,22 +15,10 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
<groupId>com.alibaba.fescar</groupId>
|
||||||
<artifactId>fescar-spring</artifactId>
|
<artifactId>fescar-spring</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.fescar</groupId>
|
|
||||||
<artifactId>fescar-rm-datasource</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
@ -32,6 +32,12 @@
|
|||||||
"name": "spring.cloud.nacos.config.ext-config",
|
"name": "spring.cloud.nacos.config.ext-config",
|
||||||
"type": "java.util.List",
|
"type": "java.util.List",
|
||||||
"description": "a set of extended configurations ."
|
"description": "a set of extended configurations ."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spring.cloud.nacos.config.enabled",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": true,
|
||||||
|
"description": "enable nacos config or not."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -25,7 +25,11 @@ import org.springframework.core.io.ByteArrayResource;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.*;
|
import java.util.Date;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author juven.xuxb
|
* @author juven.xuxb
|
||||||
|
@ -16,12 +16,8 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alicloud.acm.refresh;
|
package org.springframework.cloud.alicloud.acm.refresh;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import com.alibaba.edas.acm.ConfigService;
|
||||||
import java.math.BigInteger;
|
import com.alibaba.edas.acm.listener.ConfigChangeListener;
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -36,8 +32,12 @@ import org.springframework.context.ApplicationContextAware;
|
|||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.alibaba.edas.acm.ConfigService;
|
import java.io.UnsupportedEncodingException;
|
||||||
import com.alibaba.edas.acm.listener.ConfigChangeListener;
|
import java.math.BigInteger;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On application start up, AcmContextRefresher add diamond listeners to all application
|
* On application start up, AcmContextRefresher add diamond listeners to all application
|
||||||
|
Loading…
x
Reference in New Issue
Block a user