Skip to content
Permalink
Browse files

upgrade dubbo to 2.7.2

  • Loading branch information...
javahongxi committed Jun 8, 2019
1 parent 51a2334 commit b82e34a58872c9df5dd655f367439608fb57839e
Showing with 787 additions and 1,223 deletions.
  1. +1 −1 README.md
  2. +1 −1 pom.xml
  3. +83 −0 ...arter/src/main/java/org/apache/dubbo/spring/starter/autoconfigure/DelegatingPropertyResolver.java
  4. +24 −34 ...t-starter/src/main/java/org/apache/dubbo/spring/starter/autoconfigure/DubboAutoConfiguration.java
  5. +300 −0 ...ter/src/main/java/org/apache/dubbo/spring/starter/autoconfigure/DubboConfigurationProperties.java
  6. +53 −0 ...main/java/org/apache/dubbo/spring/starter/autoconfigure/DubboRelaxedBindingAutoConfiguration.java
  7. +3 −3 ...starter/src/main/java/org/apache/dubbo/spring/starter/autoconfigure/RelaxedDubboConfigBinder.java
  8. +120 −0 .../apache/dubbo/spring/starter/beans/factory/config/DubboConfigBeanDefinitionConflictProcessor.java
  9. +46 −0 ...ter/src/main/java/org/apache/dubbo/spring/starter/context/DubboApplicationContextInitializer.java
  10. +35 −11 ...rc/main/java/org/apache/dubbo/spring/starter/context/event/AwaitingNonWebApplicationListener.java
  11. +6 −11 ...in/java/org/apache/dubbo/spring/starter/context/event/OverrideDubboConfigApplicationListener.java
  12. +5 −4 ...r/src/main/java/org/apache/dubbo/spring/starter/context/event/WelcomeLogoApplicationListener.java
  13. +24 −28 ...main/java/org/apache/dubbo/spring/starter/env/DubboDefaultPropertiesEnvironmentPostProcessor.java
  14. +71 −12 ...ubbo/dubbo-spring-boot-starter/src/main/java/org/apache/dubbo/spring/starter/util/DubboUtils.java
  15. +1 −1 ...ubbo-spring-boot-starter/src/main/java/org/apache/dubbo/spring/starter/util/EnvironmentUtils.java
  16. +0 −1,098 ...rs-dubbo/dubbo-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json
  17. +5 −1 whatsmars-dubbo/dubbo-spring-boot-starter/src/main/resources/META-INF/spring.factories
  18. +1 −6 ...bbo-consumer-boot/src/main/java/org/hongxi/whatsmars/dubbo/demo/consumer/ConsumerApplication.java
  19. +2 −2 ...smars-dubbo-consumer-boot/src/main/java/org/hongxi/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
  20. +5 −9 ...atsmars-dubbo-consumer/src/main/java/org/hongxi/whatsmars/dubbo/demo/consumer/AsyncConsumer2.java
  21. +1 −1 ...bbo-provider-boot/src/main/java/org/hongxi/whatsmars/dubbo/demo/provider/ProviderApplication.java
@@ -28,7 +28,7 @@ whatsmars-spring-cloud | Spring Cloud 微服务生态
whatsmars-zk | zookeeper remoting 封装

### Rocket Stack
- [x] [*Dubbo*](https://github.com/alibaba/dubbo)
- [x] [*Dubbo*](https://github.com/apache/dubbo)
- [x] [*ZooKeeper*](https://github.com/apache/zookeeper)
- [x] [*RocketMQ*](https://github.com/apache/rocketmq)
- [x] [*Kafka*](https://github.com/apache/kafka)
@@ -44,7 +44,7 @@
<commons-lang.version>2.6</commons-lang.version>
<commons-logging.version>1.2</commons-logging.version>
<curator.version>2.12.0</curator.version>
<dubbo.version>2.7.0</dubbo.version>
<dubbo.version>2.7.2</dubbo.version>
<fastjson.version>1.2.44</fastjson.version>
<guava.version>20.0</guava.version>
<hessian.version>4.0.7</hessian.version>
@@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.dubbo.spring.starter.autoconfigure;

import org.apache.dubbo.common.utils.Assert;
import org.springframework.core.env.PropertyResolver;
import org.springframework.lang.Nullable;

/**
* Delegating {@link PropertyResolver}
*
* @since 2.7.1
*/
class DelegatingPropertyResolver implements PropertyResolver {

private final PropertyResolver delegate;

DelegatingPropertyResolver(PropertyResolver delegate) {
Assert.notNull(delegate, "The delegate of PropertyResolver must not be null");
this.delegate = delegate;
}

@Override
public boolean containsProperty(String key) {
return delegate.containsProperty(key);
}

@Override
@Nullable
public String getProperty(String key) {
return delegate.getProperty(key);
}

@Override
public String getProperty(String key, String defaultValue) {
return delegate.getProperty(key, defaultValue);
}

@Override
@Nullable
public <T> T getProperty(String key, Class<T> targetType) {
return delegate.getProperty(key, targetType);
}

@Override
public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
return delegate.getProperty(key, targetType, defaultValue);
}

@Override
public String getRequiredProperty(String key) throws IllegalStateException {
return delegate.getRequiredProperty(key);
}

@Override
public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException {
return delegate.getRequiredProperty(key, targetType);
}

@Override
public String resolvePlaceholders(String text) {
return delegate.resolvePlaceholders(text);
}

@Override
public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException {
return delegate.resolveRequiredPlaceholders(text);
}
}
@@ -16,69 +16,59 @@
*/
package org.apache.dubbo.spring.starter.autoconfigure;

import org.apache.dubbo.config.AbstractConfig;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor;
import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationBeanPostProcessor;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.DubboConfigConfiguration;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.core.env.Environment;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.PropertyResolver;

import java.util.Set;

import static org.apache.dubbo.spring.starter.util.DubboUtils.*;
import static java.util.Collections.emptySet;
import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;
import static org.apache.dubbo.spring.starter.util.DubboUtils.*;

/**
* Dubbo Auto {@link Configuration}
*
* @see ApplicationConfig
* @see Service
* @see Reference
* @see DubboComponentScan
* @see EnableDubboConfig
* @see EnableDubbo
* @since 1.0.0
* @see Service
* @see ServiceAnnotationBeanPostProcessor
* @see ReferenceAnnotationBeanPostProcessor
* @since 2.7.0
*/
@ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing = true)
@Configuration
@ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing = true, havingValue = "true")
@ConditionalOnClass(AbstractConfig.class)
@AutoConfigureAfter(DubboRelaxedBindingAutoConfiguration.class)
@EnableConfigurationProperties(DubboConfigurationProperties.class)
public class DubboAutoConfiguration {

/**
* Creates {@link ServiceAnnotationBeanPostProcessor} Bean
*
* @param environment {@link Environment} Bean
* @param propertyResolver {@link PropertyResolver} Bean
* @return {@link ServiceAnnotationBeanPostProcessor}
*/
@ConditionalOnProperty(name = BASE_PACKAGES_PROPERTY_NAME)
@ConditionalOnClass(ConfigurationPropertySources.class)
@ConditionalOnProperty(prefix = DUBBO_SCAN_PREFIX, name = BASE_PACKAGES_PROPERTY_NAME)
@ConditionalOnBean(name = BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
@Bean
public ServiceAnnotationBeanPostProcessor serviceAnnotationBeanPostProcessor(Environment environment) {
Set<String> packagesToScan = environment.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet());
public ServiceAnnotationBeanPostProcessor serviceAnnotationBeanPostProcessor(
@Qualifier(BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME) PropertyResolver propertyResolver) {
Set<String> packagesToScan = propertyResolver.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet());
return new ServiceAnnotationBeanPostProcessor(packagesToScan);
}

@ConditionalOnClass(Binder.class)
@Bean
@Scope(scopeName = SCOPE_PROTOTYPE)
public RelaxedDubboConfigBinder relaxedDubboConfigBinder() {
return new RelaxedDubboConfigBinder();
}

/**
* Creates {@link ReferenceAnnotationBeanPostProcessor} Bean if Absent
*
@@ -96,7 +86,7 @@ public ReferenceAnnotationBeanPostProcessor referenceAnnotationBeanPostProcessor
* @see EnableDubboConfig
* @see DubboConfigConfiguration.Single
*/
@EnableDubboConfig
@Import(DubboConfigConfiguration.Single.class)
protected static class SingleDubboConfigConfiguration {
}

@@ -106,8 +96,8 @@ public ReferenceAnnotationBeanPostProcessor referenceAnnotationBeanPostProcessor
* @see EnableDubboConfig
* @see DubboConfigConfiguration.Multiple
*/
@ConditionalOnProperty(name = MULTIPLE_CONFIG_PROPERTY_NAME, havingValue = "true")
@EnableDubboConfig(multiple = true)
@ConditionalOnProperty(prefix = DUBBO_CONFIG_PREFIX, name = MULTIPLE_CONFIG_PROPERTY_NAME, matchIfMissing = true)
@Import(DubboConfigConfiguration.Multiple.class)
protected static class MultipleDubboConfigConfiguration {
}

0 comments on commit b82e34a

Please sign in to comment.
You can’t perform that action at this time.