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

Merge remote-tracking branch 'upstream/finchley' into finchley

This commit is contained in:
fangjian0423 2019-03-29 10:40:38 +08:00
commit 2ae97ecb4f
12 changed files with 103 additions and 85 deletions

View File

@ -1,5 +0,0 @@
coverage:
status:
project: off
patch: off

View File

@ -52,7 +52,7 @@ public class DatabaseConfiguration {
String password = environment.getProperty("mysql.user.password");
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
druidDataSource.setUsername(userName);
druidDataSource.setPassword(password);
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");

View File

@ -51,7 +51,8 @@ public class DatabaseConfiguration {
String password = env.getProperty("mysql.user.password");
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
druidDataSource.setUrl(
"jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
druidDataSource.setUsername(userName);
druidDataSource.setPassword(password);
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");

View File

@ -96,9 +96,9 @@ public class OrderController {
order.id = keyHolder.getKey().longValue();
// if (random.nextBoolean()) {
// throw new RuntimeException("this is a mock Exception");
// }
if (random.nextBoolean()) {
throw new RuntimeException("this is a mock Exception");
}
LOGGER.info("Order Service End ... Created " + order);

View File

@ -52,7 +52,7 @@ public class DatabaseConfiguration {
String password = environment.getProperty("mysql.user.password");
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName);
druidDataSource.setUrl("jdbc:mysql://" + ip + ":" + port + "/" + dbName + "?serverTimezone=UTC");
druidDataSource.setUsername(userName);
druidDataSource.setPassword(password);
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");

View File

@ -21,12 +21,8 @@ import com.alibaba.nacos.api.config.ConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
@ -36,6 +32,7 @@ import static com.alibaba.nacos.api.PropertyKeyConst.CLUSTER_NAME;
import static com.alibaba.nacos.api.PropertyKeyConst.CONTEXT_PATH;
import static com.alibaba.nacos.api.PropertyKeyConst.ENCODE;
import static com.alibaba.nacos.api.PropertyKeyConst.ENDPOINT;
import static com.alibaba.nacos.api.PropertyKeyConst.ENDPOINT_PORT;
import static com.alibaba.nacos.api.PropertyKeyConst.NAMESPACE;
import static com.alibaba.nacos.api.PropertyKeyConst.SECRET_KEY;
import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;
@ -331,7 +328,17 @@ public class NacosConfigProperties {
properties.put(SECRET_KEY, Objects.toString(this.secretKey, ""));
properties.put(CONTEXT_PATH, Objects.toString(this.contextPath, ""));
properties.put(CLUSTER_NAME, Objects.toString(this.clusterName, ""));
properties.put(ENDPOINT, Objects.toString(this.endpoint, ""));
String endpoint = Objects.toString(this.endpoint, "");
if (endpoint.contains(":")) {
int index = endpoint.indexOf(":");
properties.put(ENDPOINT, endpoint.substring(0, index));
properties.put(ENDPOINT_PORT, endpoint.substring(index + 1));
}
else {
properties.put(ENDPOINT, endpoint);
}
try {
configService = NacosFactory.createConfigService(properties);
return configService;

View File

@ -391,7 +391,16 @@ public class NacosDiscoveryProperties {
properties.put(SERVER_ADDR, serverAddr);
properties.put(NAMESPACE, namespace);
properties.put(UtilAndComs.NACOS_NAMING_LOG_NAME, logName);
if (endpoint.contains(":")) {
int index = endpoint.indexOf(":");
properties.put(ENDPOINT, endpoint.substring(0, index));
properties.put(ENDPOINT_PORT, endpoint.substring(index + 1));
}
else {
properties.put(ENDPOINT, endpoint);
}
properties.put(ACCESS_KEY, accessKey);
properties.put(SECRET_KEY, secretKey);
properties.put(CLUSTER_NAME, clusterName);

View File

@ -18,6 +18,7 @@ package org.springframework.cloud.alibaba.nacos.discovery;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.alibaba.nacos.ConditionalOnNacosDiscoveryEnabled;
import org.springframework.cloud.alibaba.nacos.NacosDiscoveryProperties;
@ -45,6 +46,7 @@ public class NacosDiscoveryClientAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.watch.enabled", matchIfMissing = true)
public NacosWatch nacosWatch(NacosDiscoveryProperties nacosDiscoveryProperties) {
return new NacosWatch(nacosDiscoveryProperties);
}

View File

@ -16,5 +16,11 @@
"type": "java.lang.Boolean",
"defaultValue": "false",
"description": "naming load from local cache at application start ."
},
{
"name": "spring.cloud.nacos.discovery.watch.enabled",
"type": "java.lang.Boolean",
"defaultValue": "true",
"description": "enable nacos discovery watch or not ."
}
]}

View File

@ -18,7 +18,6 @@ package org.springframework.cloud.alicloud.acm.bootstrap;
import com.alibaba.edas.acm.ConfigService;
import com.alibaba.edas.acm.exception.ConfigException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;

View File

@ -17,7 +17,6 @@
package org.springframework.cloud.alicloud.acm.endpoint;
import com.alibaba.edas.acm.ConfigService;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.cloud.alicloud.acm.AcmPropertySourceRepository;