Skip to content

Commit

Permalink
2.7.9 Release (#741)
Browse files Browse the repository at this point in the history
* Polish #718 : [Samples] Introducing the samples deployed the external Servlet container

* Polish #718 : [Samples] Introducing the samples deployed the external Servlet container

* Polish #718 : [Samples] Introducing the samples deployed the external Servlet container

* Polish #685 : Dubbo2.7.5: Duplicate ServiceBean found

* To fix the declaration of years

* Polish #733 : Upgrading the dependencies

* Polish #734 : [Samples] Upgrading the latest Service-Introspection features

* Polish #736 : Duplicate RegistryConfig found, there already has one default RegistryConfig or more than two RegistryConfigs have the same id

* Polish #734 : [Samples] Upgrading the latest Service-Introspection features

* Revert "Polish #734 : [Samples] Upgrading the latest Service-Introspection features"

This reverts commit 3e57fbe.

* Polish #736 : Duplicate RegistryConfig found, there already has one default RegistryConfig or more than two RegistryConfigs have the same id

* Polish #728 : When openfeign and dubbo coexist, DubboAutoConfiguration.primaryPropertyResolver configuration causes openfeign call to fail

* Polish #728 : Refactor

* Bugfix test-cases

* Bugfix build errors

* Bugfix test-cases

* Bugfix test-cases
  • Loading branch information
mercyblitz authored Aug 3, 2020
1 parent bbc35a7 commit 2dffff8
Show file tree
Hide file tree
Showing 34 changed files with 330 additions and 771 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.dubbo.spring.boot.actuate.autoconfigure;

import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboConfigsMetadataEndpoint;
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboMetadataEndpoint;
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboPropertiesMetadataEndpoint;
Expand All @@ -26,7 +27,9 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -102,6 +105,16 @@ public class DubboEndpointAnnotationAutoConfigurationTest {
@Value("http://127.0.0.1:${local.management.port}${management.endpoints.web.base-path:/actuator}")
private String actuatorBaseURL;

@Before
public void init() {
ApplicationModel.reset();
}

@After
public void destroy() {
ApplicationModel.reset();
}

@Test
public void testShutdown() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
*/
package org.apache.dubbo.spring.boot.actuate.endpoint;

import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.spring.boot.util.DubboUtils;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -40,6 +43,9 @@
@SpringBootTest(
classes = {
DubboMetadataEndpoint.class
},
properties = {
"dubbo.application.name = dubbo-demo-application"
}
)
@EnableAutoConfiguration
Expand All @@ -49,6 +55,16 @@ public class DubboEndpointTest {
@Autowired
private DubboMetadataEndpoint dubboEndpoint;

@Before
public void init() {
ApplicationModel.reset();
}

@After
public void destroy() {
ApplicationModel.reset();
}

@Test
public void testInvoke() {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@
import org.springframework.context.annotation.Scope;
import org.springframework.core.env.AbstractEnvironment;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertyResolver;

import java.util.Map;
import java.util.Set;

import static com.alibaba.spring.util.PropertySourcesUtils.getSubProperties;
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME;
import static java.util.Collections.emptySet;
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_BEAN_NAME;
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME;
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX;
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_SCAN_PREFIX;
import static org.apache.dubbo.spring.boot.util.DubboUtils.RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME;
Expand All @@ -52,7 +56,6 @@
@AutoConfigureBefore(DubboRelaxedBindingAutoConfiguration.class)
public class DubboRelaxedBinding2AutoConfiguration {

@Bean(name = BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
public PropertyResolver dubboScanBasePackagesPropertyResolver(ConfigurableEnvironment environment) {
ConfigurableEnvironment propertyResolver = new AbstractEnvironment() {
@Override
Expand All @@ -62,7 +65,21 @@ protected void customizePropertySources(MutablePropertySources propertySources)
}
};
ConfigurationPropertySources.attach(propertyResolver);
return new DelegatingPropertyResolver(propertyResolver);
return propertyResolver;
}

/**
* The bean is used to scan the packages of Dubbo Service classes
*
* @param environment {@link Environment} instance
* @return non-null {@link Set}
* @since 2.7.8
*/
@ConditionalOnMissingBean(name = BASE_PACKAGES_BEAN_NAME)
@Bean(name = BASE_PACKAGES_BEAN_NAME)
public Set<String> dubboBasePackages(ConfigurableEnvironment environment) {
PropertyResolver propertyResolver = dubboScanBasePackagesPropertyResolver(environment);
return propertyResolver.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet());
}

@ConditionalOnMissingBean(name = RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME, value = ConfigurationBeanBinder.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.dubbo.spring.boot.autoconfigure;

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.beans.factory.annotation.ServiceClassPostProcessor;

import com.alibaba.spring.context.config.ConfigurationBeanBinder;
import org.junit.Test;
Expand All @@ -34,7 +34,9 @@
import org.springframework.util.ClassUtils;

import java.util.Map;
import java.util.Set;

import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_BEAN_NAME;
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME;
import static org.apache.dubbo.spring.boot.util.DubboUtils.RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME;
import static org.junit.Assert.assertEquals;
Expand All @@ -53,25 +55,22 @@
public class DubboRelaxedBinding2AutoConfigurationTest {

@Autowired
@Qualifier(BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
private PropertyResolver propertyResolver;
@Qualifier(BASE_PACKAGES_BEAN_NAME)
private Set<String> packagesToScan;

@Autowired
@Qualifier(RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME)
private ConfigurationBeanBinder dubboConfigBinder;

@Autowired
private ObjectProvider<ServiceAnnotationBeanPostProcessor> serviceAnnotationBeanPostProcessor;
private ObjectProvider<ServiceClassPostProcessor> serviceClassPostProcessor;

@Autowired
private ObjectProvider<ReferenceAnnotationBeanPostProcessor> referenceAnnotationBeanPostProcessor;

@Autowired
private Environment environment;

@Autowired
private PropertyResolver primaryPropertyResolver;

@Autowired
private Map<String, Environment> environments;

Expand All @@ -80,17 +79,16 @@ public void testBeans() {

assertTrue(ClassUtils.isAssignableValue(BinderDubboConfigBinder.class, dubboConfigBinder));

assertNotNull(serviceAnnotationBeanPostProcessor);
assertNotNull(serviceAnnotationBeanPostProcessor.getIfAvailable());
assertNotNull(serviceClassPostProcessor);
assertNotNull(serviceClassPostProcessor.getIfAvailable());
assertNotNull(referenceAnnotationBeanPostProcessor);
assertNotNull(referenceAnnotationBeanPostProcessor.getIfAvailable());

assertNotNull(environment);
assertNotNull(primaryPropertyResolver);
assertNotNull(environments);

assertEquals(primaryPropertyResolver, environment);
assertEquals(2, environments.size());

assertEquals(1, environments.size());

assertTrue(environments.containsValue(environment));
}
Expand Down

This file was deleted.

7 changes: 7 additions & 0 deletions dubbo-spring-boot-compatible/autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
Expand All @@ -66,6 +72,7 @@
<scope>test</scope>
</dependency>


</dependencies>

</project>
Loading

0 comments on commit 2dffff8

Please sign in to comment.