mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
pass code check
This commit is contained in:
parent
ddceb5f312
commit
00d449ba23
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 the original author or authors.
|
||||
* Copyright 2013-2018 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.
|
||||
@ -62,8 +62,13 @@ public class ConsumerSCLBApplication {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerSCLBApplication.class, args);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@LoadBalancerClient(value = "service-provider", configuration = MyLoadBalancerConfiguration.class)
|
||||
@LoadBalancerClient(value = "service-provider",
|
||||
configuration = MyLoadBalancerConfiguration.class)
|
||||
class MySCLBConfiguration {
|
||||
|
||||
}
|
||||
@ -79,7 +84,7 @@ public class ConsumerSCLBApplication {
|
||||
|
||||
private final Random random;
|
||||
|
||||
public RandomLoadBalancer(
|
||||
RandomLoadBalancer(
|
||||
ObjectProvider<ServiceInstanceListSupplier> serviceInstanceListSupplierProvider,
|
||||
String serviceId) {
|
||||
this.serviceInstanceListSupplierProvider = serviceInstanceListSupplierProvider;
|
||||
@ -104,6 +109,7 @@ public class ConsumerSCLBApplication {
|
||||
|
||||
return new DefaultResponse(instance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FeignClient(name = "service-provider")
|
||||
@ -126,6 +132,7 @@ public class ConsumerSCLBApplication {
|
||||
|
||||
@RestController
|
||||
class TestController {
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@ -145,8 +152,4 @@ public class ConsumerSCLBApplication {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerSCLBApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 the original author or authors.
|
||||
* Copyright 2013-2018 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.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 the original author or authors.
|
||||
* Copyright 2013-2018 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.
|
||||
@ -42,8 +42,13 @@ public class ConsumerReactiveApplication {
|
||||
return WebClient.builder();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerReactiveApplication.class, args);
|
||||
}
|
||||
|
||||
@RestController
|
||||
class MyController {
|
||||
|
||||
@Autowired
|
||||
private ReactiveDiscoveryClient reactiveDiscoveryClient;
|
||||
|
||||
@ -63,10 +68,7 @@ public class ConsumerReactiveApplication {
|
||||
.uri("http://service-provider/echo/" + name).retrieve()
|
||||
.bodyToMono(String.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerReactiveApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ import org.springframework.web.client.RestTemplate;
|
||||
public class ServiceApplication {
|
||||
|
||||
@Bean
|
||||
@SentinelRestTemplate(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class)
|
||||
@SentinelRestTemplate(blockHandler = "handleException",
|
||||
blockHandlerClass = ExceptionUtil.class)
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ public class NacosConfigAutoConfiguration {
|
||||
public NacosContextRefresher nacosContextRefresher(
|
||||
NacosConfigManager nacosConfigManager,
|
||||
NacosRefreshHistory nacosRefreshHistory) {
|
||||
// Consider that it is not necessary to be compatible with the previous configuration
|
||||
// Consider that it is not necessary to be compatible with the previous
|
||||
// configuration
|
||||
// and use the new configuration if necessary.
|
||||
return new NacosContextRefresher(nacosConfigManager, nacosRefreshHistory);
|
||||
}
|
||||
|
@ -35,26 +35,23 @@ import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
/**
|
||||
* @author liujunjie
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes =
|
||||
NacosRibbonClientPropertyOverrideTests.TestConfiguration.class,
|
||||
properties = {"spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848",
|
||||
@SpringBootTest(classes = NacosRibbonClientPropertyOverrideTests.TestConfiguration.class,
|
||||
properties = { "spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848",
|
||||
"spring.cloud.nacos.discovery.port=18080",
|
||||
"spring.cloud.nacos.discovery.service=remoteApp",
|
||||
"localApp.ribbon.NIWSServerListClassName="
|
||||
+ "com.netflix.loadbalancer.ConfigurationBasedServerList",
|
||||
"localApp.ribbon.listOfServers=127.0.0.1:19090",
|
||||
"localApp.ribbon.ServerListRefreshInterval=15000"})
|
||||
"localApp.ribbon.ServerListRefreshInterval=15000" })
|
||||
public class NacosRibbonClientPropertyOverrideTests {
|
||||
|
||||
@Autowired
|
||||
private SpringClientFactory factory;
|
||||
|
||||
|
||||
@Test
|
||||
public void serverListOverridesToTest() {
|
||||
ConfigurationBasedServerList.class
|
||||
@ -63,8 +60,7 @@ public class NacosRibbonClientPropertyOverrideTests {
|
||||
|
||||
@Test
|
||||
public void serverListRemoteTest() {
|
||||
NacosServerList.class
|
||||
.cast(getLoadBalancer("remoteApp").getServerListImpl());
|
||||
NacosServerList.class.cast(getLoadBalancer("remoteApp").getServerListImpl());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -75,10 +71,11 @@ public class NacosRibbonClientPropertyOverrideTests {
|
||||
@Configuration
|
||||
@RibbonClients
|
||||
@EnableAutoConfiguration
|
||||
@ImportAutoConfiguration({UtilAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
|
||||
ArchaiusAutoConfiguration.class, RibbonNacosAutoConfiguration.class,
|
||||
NacosDiscoveryClientConfiguration.class})
|
||||
@ImportAutoConfiguration({ UtilAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class,
|
||||
RibbonNacosAutoConfiguration.class, NacosDiscoveryClientConfiguration.class })
|
||||
protected static class TestConfiguration {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ public final class RocketMQBinderUtils {
|
||||
result.setNameServer(rocketBinderConfigurationProperties.getNameServer());
|
||||
}
|
||||
else {
|
||||
result.setNameServer(Arrays.asList(rocketMQProperties.getNameServer().split(";")));
|
||||
result.setNameServer(
|
||||
Arrays.asList(rocketMQProperties.getNameServer().split(";")));
|
||||
}
|
||||
if (rocketMQProperties.getProducer() == null
|
||||
|| StringUtils.isEmpty(rocketMQProperties.getProducer().getAccessKey())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user