Format code

pull/905/head
echooymxq 5 years ago
parent b8d9b4f787
commit bd0953cd7a

@ -59,8 +59,8 @@ import com.alibaba.cloud.dubbo.service.DubboGenericServiceFactory;
@ConditionalOnClass(name = { "org.springframework.web.client.RestTemplate" }) @ConditionalOnClass(name = { "org.springframework.web.client.RestTemplate" })
@AutoConfigureAfter(name = { @AutoConfigureAfter(name = {
"org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration" }) "org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration" })
public class DubboLoadBalancedRestTemplateAutoConfiguration public class DubboLoadBalancedRestTemplateAutoConfiguration implements
implements BeanClassLoaderAware, ApplicationContextAware, SmartInitializingSingleton { BeanClassLoaderAware, ApplicationContextAware, SmartInitializingSingleton {
private static final Class<DubboTransported> DUBBO_TRANSPORTED_CLASS = DubboTransported.class; private static final Class<DubboTransported> DUBBO_TRANSPORTED_CLASS = DubboTransported.class;
@ -123,7 +123,7 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration
if (event.getApplicationContext() == this.applicationContext) { if (event.getApplicationContext() == this.applicationContext) {
DubboTransportedAttributesResolver attributesResolver = new DubboTransportedAttributesResolver( DubboTransportedAttributesResolver attributesResolver = new DubboTransportedAttributesResolver(
environment); environment);
for (Map.Entry<String, RestTemplate> entry : restTemplates.entrySet()) { for (Map.Entry<String, RestTemplate> entry : restTemplates.entrySet()) {
String beanName = entry.getKey(); String beanName = entry.getKey();
@ -141,7 +141,7 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration
* {@link DubboTransported @DubboTransported} * {@link DubboTransported @DubboTransported}
* *
* @param beanName the bean name of {@link LoadBalanced @LoadBalanced} * @param beanName the bean name of {@link LoadBalanced @LoadBalanced}
* {@link RestTemplate} * {@link RestTemplate}
* @param attributesResolver {@link DubboTransportedAttributesResolver} * @param attributesResolver {@link DubboTransportedAttributesResolver}
* @return non-null {@link Map} * @return non-null {@link Map}
*/ */
@ -153,10 +153,10 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration
AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) beanDefinition; AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) beanDefinition;
MethodMetadata factoryMethodMetadata = annotatedBeanDefinition MethodMetadata factoryMethodMetadata = annotatedBeanDefinition
.getFactoryMethodMetadata(); .getFactoryMethodMetadata();
attributes = factoryMethodMetadata != null attributes = factoryMethodMetadata != null ? Optional
? Optional.ofNullable(factoryMethodMetadata .ofNullable(factoryMethodMetadata
.getAnnotationAttributes(DUBBO_TRANSPORTED_CLASS_NAME)).orElse(attributes) .getAnnotationAttributes(DUBBO_TRANSPORTED_CLASS_NAME))
: Collections.emptyMap(); .orElse(attributes) : Collections.emptyMap();
} }
return attributesResolver.resolve(attributes); return attributesResolver.resolve(attributes);
} }
@ -167,8 +167,8 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration
* *
* @param restTemplate {@link LoadBalanced @LoadBalanced} {@link RestTemplate} Bean * @param restTemplate {@link LoadBalanced @LoadBalanced} {@link RestTemplate} Bean
* @param dubboTranslatedAttributes the annotation dubboTranslatedAttributes * @param dubboTranslatedAttributes the annotation dubboTranslatedAttributes
* {@link RestTemplate} bean being annotated * {@link RestTemplate} bean being annotated
* {@link DubboTransported @DubboTransported} * {@link DubboTransported @DubboTransported}
*/ */
private void adaptRestTemplate(RestTemplate restTemplate, private void adaptRestTemplate(RestTemplate restTemplate,
Map<String, Object> dubboTranslatedAttributes) { Map<String, Object> dubboTranslatedAttributes) {

Loading…
Cancel
Save