Skip to content

Commit 2dffff8

Browse files
authored
2.7.9 Release (#741)
* 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
1 parent bbc35a7 commit 2dffff8

File tree

34 files changed

+330
-771
lines changed

34 files changed

+330
-771
lines changed

dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.dubbo.spring.boot.actuate.autoconfigure;
1818

1919
import org.apache.dubbo.config.annotation.DubboService;
20+
import org.apache.dubbo.rpc.model.ApplicationModel;
2021
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboConfigsMetadataEndpoint;
2122
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboMetadataEndpoint;
2223
import org.apache.dubbo.spring.boot.actuate.endpoint.DubboPropertiesMetadataEndpoint;
@@ -26,7 +27,9 @@
2627

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

108+
@Before
109+
public void init() {
110+
ApplicationModel.reset();
111+
}
112+
113+
@After
114+
public void destroy() {
115+
ApplicationModel.reset();
116+
}
117+
105118
@Test
106119
public void testShutdown() throws Exception {
107120

dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/endpoint/DubboEndpointTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
*/
1717
package org.apache.dubbo.spring.boot.actuate.endpoint;
1818

19+
import org.apache.dubbo.rpc.model.ApplicationModel;
1920
import org.apache.dubbo.spring.boot.util.DubboUtils;
2021

22+
import org.junit.After;
2123
import org.junit.Assert;
24+
import org.junit.Before;
2225
import org.junit.Test;
2326
import org.junit.runner.RunWith;
2427
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,6 +43,9 @@
4043
@SpringBootTest(
4144
classes = {
4245
DubboMetadataEndpoint.class
46+
},
47+
properties = {
48+
"dubbo.application.name = dubbo-demo-application"
4349
}
4450
)
4551
@EnableAutoConfiguration
@@ -49,6 +55,16 @@ public class DubboEndpointTest {
4955
@Autowired
5056
private DubboMetadataEndpoint dubboEndpoint;
5157

58+
@Before
59+
public void init() {
60+
ApplicationModel.reset();
61+
}
62+
63+
@After
64+
public void destroy() {
65+
ApplicationModel.reset();
66+
}
67+
5268
@Test
5369
public void testInvoke() {
5470

dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DelegatingPropertyResolver.java

-83
This file was deleted.

dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.java

+20-3
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@
2727
import org.springframework.context.annotation.Scope;
2828
import org.springframework.core.env.AbstractEnvironment;
2929
import org.springframework.core.env.ConfigurableEnvironment;
30+
import org.springframework.core.env.Environment;
3031
import org.springframework.core.env.MapPropertySource;
3132
import org.springframework.core.env.MutablePropertySources;
3233
import org.springframework.core.env.PropertyResolver;
3334

3435
import java.util.Map;
36+
import java.util.Set;
3537

3638
import static com.alibaba.spring.util.PropertySourcesUtils.getSubProperties;
37-
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME;
39+
import static java.util.Collections.emptySet;
40+
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_BEAN_NAME;
41+
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME;
3842
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX;
3943
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_SCAN_PREFIX;
4044
import static org.apache.dubbo.spring.boot.util.DubboUtils.RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME;
@@ -52,7 +56,6 @@
5256
@AutoConfigureBefore(DubboRelaxedBindingAutoConfiguration.class)
5357
public class DubboRelaxedBinding2AutoConfiguration {
5458

55-
@Bean(name = BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
5659
public PropertyResolver dubboScanBasePackagesPropertyResolver(ConfigurableEnvironment environment) {
5760
ConfigurableEnvironment propertyResolver = new AbstractEnvironment() {
5861
@Override
@@ -62,7 +65,21 @@ protected void customizePropertySources(MutablePropertySources propertySources)
6265
}
6366
};
6467
ConfigurationPropertySources.attach(propertyResolver);
65-
return new DelegatingPropertyResolver(propertyResolver);
68+
return propertyResolver;
69+
}
70+
71+
/**
72+
* The bean is used to scan the packages of Dubbo Service classes
73+
*
74+
* @param environment {@link Environment} instance
75+
* @return non-null {@link Set}
76+
* @since 2.7.8
77+
*/
78+
@ConditionalOnMissingBean(name = BASE_PACKAGES_BEAN_NAME)
79+
@Bean(name = BASE_PACKAGES_BEAN_NAME)
80+
public Set<String> dubboBasePackages(ConfigurableEnvironment environment) {
81+
PropertyResolver propertyResolver = dubboScanBasePackagesPropertyResolver(environment);
82+
return propertyResolver.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet());
6683
}
6784

6885
@ConditionalOnMissingBean(name = RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME, value = ConfigurationBeanBinder.class)

dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.apache.dubbo.spring.boot.autoconfigure;
1818

1919
import org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor;
20-
import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationBeanPostProcessor;
20+
import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceClassPostProcessor;
2121

2222
import com.alibaba.spring.context.config.ConfigurationBeanBinder;
2323
import org.junit.Test;
@@ -34,7 +34,9 @@
3434
import org.springframework.util.ClassUtils;
3535

3636
import java.util.Map;
37+
import java.util.Set;
3738

39+
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_BEAN_NAME;
3840
import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME;
3941
import static org.apache.dubbo.spring.boot.util.DubboUtils.RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME;
4042
import static org.junit.Assert.assertEquals;
@@ -53,25 +55,22 @@
5355
public class DubboRelaxedBinding2AutoConfigurationTest {
5456

5557
@Autowired
56-
@Qualifier(BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
57-
private PropertyResolver propertyResolver;
58+
@Qualifier(BASE_PACKAGES_BEAN_NAME)
59+
private Set<String> packagesToScan;
5860

5961
@Autowired
6062
@Qualifier(RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME)
6163
private ConfigurationBeanBinder dubboConfigBinder;
6264

6365
@Autowired
64-
private ObjectProvider<ServiceAnnotationBeanPostProcessor> serviceAnnotationBeanPostProcessor;
66+
private ObjectProvider<ServiceClassPostProcessor> serviceClassPostProcessor;
6567

6668
@Autowired
6769
private ObjectProvider<ReferenceAnnotationBeanPostProcessor> referenceAnnotationBeanPostProcessor;
6870

6971
@Autowired
7072
private Environment environment;
7173

72-
@Autowired
73-
private PropertyResolver primaryPropertyResolver;
74-
7574
@Autowired
7675
private Map<String, Environment> environments;
7776

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

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

83-
assertNotNull(serviceAnnotationBeanPostProcessor);
84-
assertNotNull(serviceAnnotationBeanPostProcessor.getIfAvailable());
82+
assertNotNull(serviceClassPostProcessor);
83+
assertNotNull(serviceClassPostProcessor.getIfAvailable());
8584
assertNotNull(referenceAnnotationBeanPostProcessor);
8685
assertNotNull(referenceAnnotationBeanPostProcessor.getIfAvailable());
8786

8887
assertNotNull(environment);
89-
assertNotNull(primaryPropertyResolver);
9088
assertNotNull(environments);
9189

92-
assertEquals(primaryPropertyResolver, environment);
93-
assertEquals(2, environments.size());
90+
91+
assertEquals(1, environments.size());
9492

9593
assertTrue(environments.containsValue(environment));
9694
}

dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/context/event/AwaitingNonWebApplicationListenerTest.java

-57
This file was deleted.

dubbo-spring-boot-compatible/autoconfigure/pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
<optional>true</optional>
4141
</dependency>
4242

43+
<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot</artifactId>
46+
<optional>true</optional>
47+
</dependency>
48+
4349
<dependency>
4450
<groupId>org.springframework.boot</groupId>
4551
<artifactId>spring-boot-starter-logging</artifactId>
@@ -66,6 +72,7 @@
6672
<scope>test</scope>
6773
</dependency>
6874

75+
6976
</dependencies>
7077

7178
</project>

0 commit comments

Comments
 (0)