diff --git a/README.md b/README.md index 60cfbb8a6..f59b98a98 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![codecov](https://codecov.io/gh/apache/incubator-dubbo-spring-boot-project/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/incubator-dubbo-spring-boot-project) ![license](https://img.shields.io/github/license/apache/incubator-dubbo-spring-boot-project.svg) -[Apache Dubbo(incubating)](https://github.com/apache/incubator-dubbo) Spring Boot Project makes it easy to create [Spring Boot](https://github.com/spring-projects/spring-boot/) application using Dubbo as RPC Framework. What's more, it aslo provides +[Apache Dubbo(incubating)](https://github.com/apache/incubator-dubbo) Spring Boot Project makes it easy to create [Spring Boot](https://github.com/spring-projects/spring-boot/) application using Dubbo as RPC Framework. What's more, it also provides * [auto-configure features](dubbo-spring-boot-autoconfigure) (e.g., annotation-driven, auto configuration, externalized configuration). * [production-ready features](dubbo-spring-boot-actuator) (e.g., security, health checks, externalized configuration). @@ -20,7 +20,7 @@ You can introduce the latest `dubbo-spring-boot-starter` to your project by addi ```xml 2.1.1.RELEASE - 2.7.0 + 2.7.1 @@ -34,7 +34,7 @@ You can introduce the latest `dubbo-spring-boot-starter` to your project by addi import - + org.apache.dubbo dubbo-dependencies-bom @@ -70,7 +70,7 @@ You can introduce the latest `dubbo-spring-boot-starter` to your project by addi org.apache.dubbo dubbo-spring-boot-starter - 2.7.0 + 2.7.1 diff --git a/README_CN.md b/README_CN.md index 56187debc..0ad05b862 100644 --- a/README_CN.md +++ b/README_CN.md @@ -22,7 +22,7 @@ ```xml 2.1.1.RELEASE - 2.7.0 + 2.7.1 @@ -72,7 +72,7 @@ org.apache.dubbo dubbo-spring-boot-starter - 2.7.0 + 2.7.1 diff --git a/dubbo-spring-boot-actuator/README.md b/dubbo-spring-boot-actuator/README.md index ec743c619..659006c75 100644 --- a/dubbo-spring-boot-actuator/README.md +++ b/dubbo-spring-boot-actuator/README.md @@ -22,7 +22,7 @@ You can introduce the latest `dubbo-spring-boot-actuator` to your project by ad org.apache.dubbo dubbo-spring-boot-actuator - 2.7.0 + 2.7.1 ``` @@ -171,8 +171,8 @@ Actuator endpoint `dubbo` supports Actuator Endpoints : { "timestamp": 1516623290166, "versions": { - "dubbo-spring-boot": "2.7.0", - "dubbo": "2.7.0" + "dubbo-spring-boot": "2.7.1", + "dubbo": "2.7.1" }, "urls": { "dubbo": "https://github.com/apache/incubator-dubbo/", diff --git a/dubbo-spring-boot-actuator/pom.xml b/dubbo-spring-boot-actuator/pom.xml index ef7eed38c..bf905f1bf 100644 --- a/dubbo-spring-boot-actuator/pom.xml +++ b/dubbo-spring-boot-actuator/pom.xml @@ -58,13 +58,6 @@ true - - - org.springframework.boot - spring-boot-configuration-processor - true - - org.apache.dubbo diff --git a/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java b/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java index d9747cc08..954ad7a9a 100644 --- a/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java +++ b/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java @@ -16,8 +16,6 @@ */ package org.apache.dubbo.spring.boot.actuate.autoconfigure; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.dubbo.config.annotation.Service; import org.apache.dubbo.spring.boot.actuate.endpoint.DubboConfigsMetadataEndpoint; import org.apache.dubbo.spring.boot.actuate.endpoint.DubboMetadataEndpoint; @@ -25,6 +23,9 @@ import org.apache.dubbo.spring.boot.actuate.endpoint.DubboReferencesMetadataEndpoint; import org.apache.dubbo.spring.boot.actuate.endpoint.DubboServicesMetadataEndpoint; import org.apache.dubbo.spring.boot.actuate.endpoint.DubboShutdownEndpoint; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -159,7 +160,7 @@ public void testServices() { Assert.assertEquals(1, services.size()); - Map demoServiceMeta = services.get("ServiceBean:org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAnnotationAutoConfigurationTest$DemoService:1.0.0"); + Map demoServiceMeta = services.get("providers:my-protocol:org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAnnotationAutoConfigurationTest$DemoService:1.0.0"); Assert.assertEquals("1.0.0", demoServiceMeta.get("version")); diff --git a/dubbo-spring-boot-autoconfigure/README.md b/dubbo-spring-boot-autoconfigure/README.md index 0e32d7ab3..ac33ef440 100644 --- a/dubbo-spring-boot-autoconfigure/README.md +++ b/dubbo-spring-boot-autoconfigure/README.md @@ -23,7 +23,7 @@ You can introduce the latest `dubbo-spring-boot-autoconfigure` to your project org.apache.dubbo dubbo-spring-boot-autoconfigure - 2.7.0 + 2.7.1 ``` @@ -213,13 +213,13 @@ If you used advanced IDE tools , for instance [Jetbrains IDEA Ultimate](https:// #### Case 1 - Single Bindings -![](../config-popup-window.png) +![](config-popup-window.png) #### Case 2 - Mutiple Bindings -![](../mconfig-popup-window.png) +![](mconfig-popup-window.png) ​ diff --git a/config-popup-window.png b/dubbo-spring-boot-autoconfigure/config-popup-window.png similarity index 100% rename from config-popup-window.png rename to dubbo-spring-boot-autoconfigure/config-popup-window.png diff --git a/mconfig-popup-window.png b/dubbo-spring-boot-autoconfigure/mconfig-popup-window.png similarity index 100% rename from mconfig-popup-window.png rename to dubbo-spring-boot-autoconfigure/mconfig-popup-window.png diff --git a/dubbo-spring-boot-autoconfigure/pom.xml b/dubbo-spring-boot-autoconfigure/pom.xml index 83f1a4b29..190bfdb9d 100644 --- a/dubbo-spring-boot-autoconfigure/pom.xml +++ b/dubbo-spring-boot-autoconfigure/pom.xml @@ -54,13 +54,6 @@ true - - - org.springframework.boot - spring-boot-configuration-processor - true - - org.apache.dubbo diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DelegatingPropertyResolver.java b/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DelegatingPropertyResolver.java new file mode 100644 index 000000000..b36d921d6 --- /dev/null +++ b/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DelegatingPropertyResolver.java @@ -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.boot.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 getProperty(String key, Class targetType) { + return delegate.getProperty(key, targetType); + } + + @Override + public T getProperty(String key, Class targetType, T defaultValue) { + return delegate.getProperty(key, targetType, defaultValue); + } + + @Override + public String getRequiredProperty(String key) throws IllegalStateException { + return delegate.getRequiredProperty(key); + } + + @Override + public T getRequiredProperty(String key, Class 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); + } +} diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.java b/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.java index 97aa275f2..2b572731c 100644 --- a/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.java +++ b/dubbo-spring-boot-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.java @@ -61,7 +61,7 @@ protected void customizePropertySources(MutablePropertySources propertySources) } }; ConfigurationPropertySources.attach(propertyResolver); - return propertyResolver; + return new DelegatingPropertyResolver(propertyResolver); } @ConditionalOnMissingBean(name = RELAXED_DUBBO_CONFIG_BINDER_BEAN_NAME, value = DubboConfigBinder.class) diff --git a/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java b/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java index 4aee5a50d..bc354dc71 100644 --- a/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java +++ b/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java @@ -27,10 +27,13 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.env.Environment; import org.springframework.core.env.PropertyResolver; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.ClassUtils; +import java.util.Collection; + 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; @@ -58,6 +61,12 @@ public class DubboRelaxedBinding2AutoConfigurationTest { @Autowired private ObjectProvider referenceAnnotationBeanPostProcessor; + @Autowired + private Environment environment; + + @Autowired + private Collection environments; + @Test public void testBeans() { Assert.assertTrue(ClassUtils.isAssignableValue(BinderDubboConfigBinder.class, dubboConfigBinder)); @@ -65,6 +74,13 @@ public void testBeans() { Assert.assertNotNull(serviceAnnotationBeanPostProcessor.getIfAvailable()); Assert.assertNotNull(referenceAnnotationBeanPostProcessor); Assert.assertNotNull(referenceAnnotationBeanPostProcessor.getIfAvailable()); + + Assert.assertNotNull(environment); + Assert.assertNotNull(environments); + + Assert.assertEquals(1, environments.size()); + + Assert.assertTrue(environments.contains(environment)); } } diff --git a/dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfiguration.java b/dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfiguration.java index a74cab1f0..92a9ba0aa 100644 --- a/dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfiguration.java +++ b/dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfiguration.java @@ -20,11 +20,13 @@ import org.apache.dubbo.spring.boot.actuate.endpoint.DubboEndpoint; import org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration; import org.apache.dubbo.spring.boot.autoconfigure.DubboRelaxedBindingAutoConfiguration; + import org.springframework.boot.actuate.condition.ConditionalOnEnabledEndpoint; import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -41,6 +43,7 @@ DubboAutoConfiguration.class, DubboRelaxedBindingAutoConfiguration.class }) +@EnableConfigurationProperties(DubboEndpoint.class) public class DubboEndpointAutoConfiguration { @Bean diff --git a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java index 9f5f51ec5..3227723a8 100644 --- a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java +++ b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java @@ -16,8 +16,6 @@ */ package org.apache.dubbo.spring.boot.actuate.autoconfigure; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.dubbo.config.annotation.Service; import org.apache.dubbo.spring.boot.actuate.endpoint.DubboEndpoint; import org.apache.dubbo.spring.boot.actuate.endpoint.metadata.DubboConfigsMetadata; @@ -25,6 +23,9 @@ import org.apache.dubbo.spring.boot.actuate.endpoint.metadata.DubboReferencesMetadata; import org.apache.dubbo.spring.boot.actuate.endpoint.metadata.DubboServicesMetadata; import org.apache.dubbo.spring.boot.actuate.endpoint.metadata.DubboShutdownMetadata; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -163,7 +164,7 @@ public void testServices() { Assert.assertEquals(1, services.size()); - Map demoServiceMeta = services.get("ServiceBean:org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAutoConfigurationTest$DemoService:1.0.0"); + Map demoServiceMeta = services.get("providers:my-protocol:org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAutoConfigurationTest$DemoService:1.0.0"); Assert.assertEquals("1.0.0", demoServiceMeta.get("version")); diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfiguration.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfiguration.java index f49e49e41..059a3e6a2 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfiguration.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfiguration.java @@ -22,13 +22,16 @@ import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationBeanPostProcessor; import org.apache.dubbo.config.spring.context.annotation.DubboConfigConfiguration; import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; + 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.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import org.springframework.core.env.PropertyResolver; import java.util.Set; @@ -53,6 +56,7 @@ @ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing = true) @Configuration @AutoConfigureAfter(DubboRelaxedBindingAutoConfiguration.class) +@EnableConfigurationProperties(DubboConfigurationProperties.class) public class DubboAutoConfiguration { /** @@ -87,7 +91,7 @@ public ReferenceAnnotationBeanPostProcessor referenceAnnotationBeanPostProcessor * @see EnableDubboConfig * @see DubboConfigConfiguration.Single */ - @EnableDubboConfig + @Import(DubboConfigConfiguration.Single.class) protected static class SingleDubboConfigConfiguration { } @@ -98,7 +102,7 @@ protected static class SingleDubboConfigConfiguration { * @see DubboConfigConfiguration.Multiple */ @ConditionalOnProperty(prefix = DUBBO_CONFIG_PREFIX, name = MULTIPLE_CONFIG_PROPERTY_NAME, matchIfMissing = true) - @EnableDubboConfig(multiple = true) + @Import(DubboConfigConfiguration.Multiple.class) protected static class MultipleDubboConfigConfiguration { } diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java new file mode 100644 index 000000000..495c152ff --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java @@ -0,0 +1,300 @@ +/* + * 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.boot.autoconfigure; + +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.ConsumerConfig; +import org.apache.dubbo.config.MetadataReportConfig; +import org.apache.dubbo.config.ModuleConfig; +import org.apache.dubbo.config.MonitorConfig; +import org.apache.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.ProviderConfig; +import org.apache.dubbo.config.RegistryConfig; +import org.apache.dubbo.config.spring.ConfigCenterBean; +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX; + +/** + * Dubbo {@link ConfigurationProperties Config Properties} only used to generate JSON metadata(non-public class) + * + * @since 2.7.1 + */ +@ConfigurationProperties(DUBBO_PREFIX) +class DubboConfigurationProperties { + + @NestedConfigurationProperty + private Config config = new Config(); + + @NestedConfigurationProperty + private Scan scan = new Scan(); + + // Single Config Bindings + @NestedConfigurationProperty + private ApplicationConfig application = new ApplicationConfig(); + + @NestedConfigurationProperty + private ModuleConfig module = new ModuleConfig(); + + @NestedConfigurationProperty + private RegistryConfig registry = new RegistryConfig(); + + @NestedConfigurationProperty + private ProtocolConfig protocol = new ProtocolConfig(); + + @NestedConfigurationProperty + private MonitorConfig monitor = new MonitorConfig(); + + @NestedConfigurationProperty + private ProviderConfig provider = new ProviderConfig(); + + @NestedConfigurationProperty + private ConsumerConfig consumer = new ConsumerConfig(); + + @NestedConfigurationProperty + private ConfigCenterBean configCenter = new ConfigCenterBean(); + + @NestedConfigurationProperty + private MetadataReportConfig metadataReport = new MetadataReportConfig(); + + // Multiple Config Bindings + + private Map modules = new LinkedHashMap<>(); + + private Map registrys = new LinkedHashMap<>(); + + private Map protocols = new LinkedHashMap<>(); + + private Map monitors = new LinkedHashMap<>(); + + private Map providers = new LinkedHashMap<>(); + + private Map consumers = new LinkedHashMap<>(); + + private Map configCenters = new LinkedHashMap<>(); + + private Map metadataReports = new LinkedHashMap<>(); + + public Config getConfig() { + return config; + } + + public void setConfig(Config config) { + this.config = config; + } + + public Scan getScan() { + return scan; + } + + public void setScan(Scan scan) { + this.scan = scan; + } + + public ApplicationConfig getApplication() { + return application; + } + + public void setApplication(ApplicationConfig application) { + this.application = application; + } + + public ModuleConfig getModule() { + return module; + } + + public void setModule(ModuleConfig module) { + this.module = module; + } + + public RegistryConfig getRegistry() { + return registry; + } + + public void setRegistry(RegistryConfig registry) { + this.registry = registry; + } + + public ProtocolConfig getProtocol() { + return protocol; + } + + public void setProtocol(ProtocolConfig protocol) { + this.protocol = protocol; + } + + public MonitorConfig getMonitor() { + return monitor; + } + + public void setMonitor(MonitorConfig monitor) { + this.monitor = monitor; + } + + public ProviderConfig getProvider() { + return provider; + } + + public void setProvider(ProviderConfig provider) { + this.provider = provider; + } + + public ConsumerConfig getConsumer() { + return consumer; + } + + public void setConsumer(ConsumerConfig consumer) { + this.consumer = consumer; + } + + public ConfigCenterBean getConfigCenter() { + return configCenter; + } + + public void setConfigCenter(ConfigCenterBean configCenter) { + this.configCenter = configCenter; + } + + public MetadataReportConfig getMetadataReport() { + return metadataReport; + } + + public void setMetadataReport(MetadataReportConfig metadataReport) { + this.metadataReport = metadataReport; + } + + public Map getModules() { + return modules; + } + + public void setModules(Map modules) { + this.modules = modules; + } + + public Map getRegistrys() { + return registrys; + } + + public void setRegistrys(Map registrys) { + this.registrys = registrys; + } + + public Map getProtocols() { + return protocols; + } + + public void setProtocols(Map protocols) { + this.protocols = protocols; + } + + public Map getMonitors() { + return monitors; + } + + public void setMonitors(Map monitors) { + this.monitors = monitors; + } + + public Map getProviders() { + return providers; + } + + public void setProviders(Map providers) { + this.providers = providers; + } + + public Map getConsumers() { + return consumers; + } + + public void setConsumers(Map consumers) { + this.consumers = consumers; + } + + public Map getConfigCenters() { + return configCenters; + } + + public void setConfigCenters(Map configCenters) { + this.configCenters = configCenters; + } + + public Map getMetadataReports() { + return metadataReports; + } + + public void setMetadataReports(Map metadataReports) { + this.metadataReports = metadataReports; + } + + static class Config { + + /** + * Indicates multiple properties binding from externalized configuration or not. + */ + private boolean multiple = DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE; + + /** + * The property name of override Dubbo config + */ + private boolean override = DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE; + + public boolean isOverride() { + return override; + } + + public void setOverride(boolean override) { + this.override = override; + } + + public boolean isMultiple() { + return multiple; + } + + public void setMultiple(boolean multiple) { + this.multiple = multiple; + } + } + + static class Scan { + + /** + * The basePackages to scan , the multiple-value is delimited by comma + * + * @see EnableDubbo#scanBasePackages() + */ + private Set basePackages = new LinkedHashSet<>(); + + public Set getBasePackages() { + return basePackages; + } + + public void setBasePackages(Set basePackages) { + this.basePackages = basePackages; + } + } +} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanCustomizer.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanCustomizer.java new file mode 100644 index 000000000..518aed829 --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanCustomizer.java @@ -0,0 +1,65 @@ +/* + * 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.boot.beans.factory.config; + +import org.apache.dubbo.config.AbstractConfig; +import org.apache.dubbo.config.spring.context.config.NamePropertyDefaultValueDubboConfigBeanCustomizer; + +import org.springframework.beans.BeanUtils; + +import java.lang.reflect.Method; + +import static org.springframework.util.ReflectionUtils.findMethod; +import static org.springframework.util.ReflectionUtils.invokeMethod; + + +/** + * Current implementation will be replaced {@link NamePropertyDefaultValueDubboConfigBeanCustomizer} in Dubbo 2.7.2 + * + * @since 2.7.1 + * @deprecated + */ +@Deprecated +class DubboConfigBeanCustomizer extends NamePropertyDefaultValueDubboConfigBeanCustomizer { + + @Override + public void customize(String beanName, AbstractConfig dubboConfigBean) { + boolean valid = isValidPropertyName(dubboConfigBean, beanName); + if (valid) { + super.customize(beanName, dubboConfigBean); + } + } + + private boolean isValidPropertyName(AbstractConfig dubboConfigBean, String propertyValue) { + boolean valid = true; + String propertyName = "name"; + // AbstractConfig.checkName(String,String) + Method method = findMethod(AbstractConfig.class, "checkName", String.class, String.class); + try { + if (!method.isAccessible()) { + method.setAccessible(true); + } + if (BeanUtils.getPropertyDescriptor(dubboConfigBean.getClass(), propertyName) != null) { + invokeMethod(method, null, propertyName, propertyValue); + } + } catch (IllegalStateException e) { + valid = false; + } + + return valid; + } +} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessor.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessor.java new file mode 100644 index 000000000..807610186 --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessor.java @@ -0,0 +1,120 @@ +/* + * 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.boot.beans.factory.config; + +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactoryUtils; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.env.Environment; + +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors; +import static org.springframework.context.ConfigurableApplicationContext.ENVIRONMENT_BEAN_NAME; + +/** + * Dubbo Config {@link BeanDefinition Bean Definition} {@link BeanDefinitionRegistryPostProcessor processor} + * to resolve conflict + * + * @see BeanDefinition + * @see BeanDefinitionRegistryPostProcessor + * @since 2.7.1 + */ +public class DubboConfigBeanDefinitionConflictProcessor implements BeanDefinitionRegistryPostProcessor, Ordered { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + private BeanDefinitionRegistry registry; + + private Environment environment; + + @Override + public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { + this.registry = registry; + } + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + resolveUniqueApplicationConfigBean(registry, beanFactory); + } + + /** + * Resolve the unique {@link ApplicationConfig} Bean + * + * @param registry {@link BeanDefinitionRegistry} instance + * @param beanFactory {@link ConfigurableListableBeanFactory} instance + * @see EnableDubboConfig + */ + private void resolveUniqueApplicationConfigBean(BeanDefinitionRegistry registry, + ConfigurableListableBeanFactory beanFactory) { + + this.environment = beanFactory.getBean(ENVIRONMENT_BEAN_NAME, Environment.class); + + String[] beansNames = beanNamesForTypeIncludingAncestors(beanFactory, ApplicationConfig.class); + + if (beansNames.length < 2) { // If the number of ApplicationConfig beans is less than two, return immediately. + return; + } + + // Remove ApplicationConfig Beans that are configured by "dubbo.application.*" + Stream.of(beansNames) + .filter(this::isConfiguredApplicationConfigBeanName) + .forEach(registry::removeBeanDefinition); + + beansNames = beanNamesForTypeIncludingAncestors(beanFactory, ApplicationConfig.class); + + if (beansNames.length > 1) { + throw new IllegalStateException(String.format("There are more than one instances of %s, whose bean definitions : %s", + ApplicationConfig.class.getSimpleName(), + Stream.of(beansNames) + .map(registry::getBeanDefinition) + .collect(Collectors.toList())) + ); + } + } + + private boolean isConfiguredApplicationConfigBeanName(String beanName) { + boolean removed = BeanFactoryUtils.isGeneratedBeanName(beanName) + // Dubbo ApplicationConfig id as bean name + || Objects.equals(beanName, environment.getProperty("dubbo.application.id")); + + if (removed) { + if (logger.isWarnEnabled()) { + logger.warn("The {} bean [ name : {} ] has been removed!", ApplicationConfig.class.getSimpleName(), beanName); + } + } + + return removed; + } + + + @Override + public int getOrder() { + return LOWEST_PRECEDENCE; + } +} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/OverrideBeanDefinitionRegistryPostProcessor.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/OverrideBeanDefinitionRegistryPostProcessor.java new file mode 100644 index 000000000..164f081df --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/OverrideBeanDefinitionRegistryPostProcessor.java @@ -0,0 +1,43 @@ +/* + * 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.boot.beans.factory.config; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; + +import static org.apache.dubbo.config.spring.context.config.NamePropertyDefaultValueDubboConfigBeanCustomizer.BEAN_NAME; +import static org.apache.dubbo.config.spring.util.BeanRegistrar.registerInfrastructureBean; + +/** + * Override {@link BeanDefinitionRegistryPostProcessor} + * + * @since 2.7.1 + */ +public class OverrideBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor { + + @Override + public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { + registerInfrastructureBean(registry, BEAN_NAME, DubboConfigBeanCustomizer.class); + } + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + } +} + diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/DubboApplicationContextInitializer.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/DubboApplicationContextInitializer.java new file mode 100644 index 000000000..939f17bae --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/DubboApplicationContextInitializer.java @@ -0,0 +1,49 @@ +/* + * 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.boot.context; + +import org.apache.dubbo.spring.boot.beans.factory.config.DubboConfigBeanDefinitionConflictProcessor; +import org.apache.dubbo.spring.boot.beans.factory.config.OverrideBeanDefinitionRegistryPostProcessor; + +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.Ordered; + +/** + * Dubbo {@link ApplicationContextInitializer} implementation + * + * @see ApplicationContextInitializer + * @since 2.7.1 + */ +public class DubboApplicationContextInitializer implements ApplicationContextInitializer, Ordered { + + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + overrideBeanDefinitions(applicationContext); + } + + private void overrideBeanDefinitions(ConfigurableApplicationContext applicationContext) { + applicationContext.addBeanFactoryPostProcessor(new OverrideBeanDefinitionRegistryPostProcessor()); + applicationContext.addBeanFactoryPostProcessor(new DubboConfigBeanDefinitionConflictProcessor()); + } + + @Override + public int getOrder() { + return HIGHEST_PRECEDENCE; + } + +} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java index f053227ff..05c8a5de8 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java @@ -17,6 +17,7 @@ package org.apache.dubbo.spring.boot.context.event; import org.apache.dubbo.common.Version; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; @@ -75,7 +76,7 @@ String buildBannerText() { bannerTextBuilder .append(LINE_SEPARATOR) .append(LINE_SEPARATOR) - .append(" :: Dubbo Spring Boot (v").append(Version.getVersion(getClass(), "1.0.0")).append(") : ") + .append(" :: Dubbo Spring Boot (v").append(Version.getVersion(getClass(), Version.getVersion())).append(") : ") .append(DUBBO_SPRING_BOOT_GITHUB_URL) .append(LINE_SEPARATOR) .append(" :: Dubbo (v").append(Version.getVersion()).append(") : ") diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java index 0efbc6b48..a8546ecba 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java @@ -16,11 +16,7 @@ */ package org.apache.dubbo.spring.boot.env; -import org.apache.dubbo.config.ApplicationConfig; -import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; -import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfigBinding; import org.springframework.boot.SpringApplication; -import org.springframework.boot.context.ContextIdApplicationContextInitializer; import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.Ordered; @@ -36,6 +32,11 @@ import java.util.Map; import java.util.Properties; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_APPLICATION_NAME_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_APPLICATION_QOS_ENABLE_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_CONFIG_MULTIPLE_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.SPRING_APPLICATION_NAME_PROPERTY; + /** * The lowest precedence {@link EnvironmentPostProcessor} processes * {@link SpringApplication#setDefaultProperties(Properties) Spring Boot default properties} for Dubbo @@ -46,32 +47,13 @@ public class DubboDefaultPropertiesEnvironmentPostProcessor implements Environme /** * The name of default {@link PropertySource} defined in SpringApplication#configurePropertySources method. */ - private static final String PROPERTY_SOURCE_NAME = "defaultProperties"; - - /** - * The property name of Spring Application - * - * @see ContextIdApplicationContextInitializer - */ - private static final String SPRING_APPLICATION_NAME_PROPERTY = "spring.application.name"; - - /** - * The property name of {@link ApplicationConfig} - * - * @see EnableDubboConfig - * @see EnableDubboConfigBinding - */ - private static final String DUBBO_APPLICATION_NAME_PROPERTY = "dubbo.application.name"; + public static final String PROPERTY_SOURCE_NAME = "defaultProperties"; /** - * The property name of {@link EnableDubboConfig#multiple() @EnableDubboConfig.multiple()} + * The property name of "spring.main.allow-bean-definition-overriding". + * Please refer to: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding */ - private static final String DUBBO_CONFIG_MULTIPLE_PROPERTY = "dubbo.config.multiple"; - - /** - * The property name of {@link ApplicationConfig#getQosEnable() application's QOS enable} - */ - private static final String DUBBO_APPLICATION_QOS_ENABLE_PROPERTY = "dubbo.application.qos-enable"; + public static final String ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY = "spring.main.allow-bean-definition-overriding"; @Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { @@ -92,6 +74,7 @@ private Map createDefaultProperties(ConfigurableEnvironment envi setDubboApplicationNameProperty(environment, defaultProperties); setDubboConfigMultipleProperty(defaultProperties); setDubboApplicationQosEnableProperty(defaultProperties); + setAllowBeanDefinitionOverriding(defaultProperties); return defaultProperties; } @@ -111,6 +94,18 @@ private void setDubboApplicationQosEnableProperty(Map defaultPro defaultProperties.put(DUBBO_APPLICATION_QOS_ENABLE_PROPERTY, Boolean.FALSE.toString()); } + /** + * Set {@link #ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY "spring.main.allow-bean-definition-overriding"} to be + * true as default. + * + * @param defaultProperties the default {@link Properties properties} + * @see #ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY + * @since 2.7.1 + */ + private void setAllowBeanDefinitionOverriding(Map defaultProperties) { + defaultProperties.put(ALLOW_BEAN_DEFINITION_OVERRIDING_PROPERTY, Boolean.TRUE.toString()); + } + /** * Copy from BusEnvironmentPostProcessor#addOrReplace(MutablePropertySources, Map) * diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java index 5b9fcd491..98b0bcdec 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java @@ -16,8 +16,13 @@ */ package org.apache.dubbo.spring.boot.util; +import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationBeanPostProcessor; +import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; +import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfigBinding; import org.apache.dubbo.config.spring.context.properties.DubboConfigBinder; + +import org.springframework.boot.context.ContextIdApplicationContextInitializer; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.PropertyResolver; @@ -126,6 +131,47 @@ public abstract class DubboUtils { */ public static final String BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME = "dubboScanBasePackagesPropertyResolver"; + /** + * The property name of Spring Application + * + * @see ContextIdApplicationContextInitializer + * @since 2.7.1 + */ + public static final String SPRING_APPLICATION_NAME_PROPERTY = "spring.application.name"; + + /** + * The property id of {@link ApplicationConfig} Bean + * + * @see EnableDubboConfig + * @see EnableDubboConfigBinding + * @since 2.7.1 + */ + public static final String DUBBO_APPLICATION_ID_PROPERTY = "dubbo.application.id"; + + /** + * The property name of {@link ApplicationConfig} + * + * @see EnableDubboConfig + * @see EnableDubboConfigBinding + * @since 2.7.1 + */ + public static final String DUBBO_APPLICATION_NAME_PROPERTY = "dubbo.application.name"; + + /** + * The property name of {@link ApplicationConfig#getQosEnable() application's QOS enable} + * + * @since 2.7.1 + */ + public static final String DUBBO_APPLICATION_QOS_ENABLE_PROPERTY = "dubbo.application.qos-enable"; + + /** + * The property name of {@link EnableDubboConfig#multiple() @EnableDubboConfig.multiple()} + * + * @since 2.7.1 + */ + public static final String DUBBO_CONFIG_MULTIPLE_PROPERTY = "dubbo.config.multiple"; + + /** * Filters Dubbo Properties from {@link ConfigurableEnvironment} * diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json b/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json deleted file mode 100644 index d8101217c..000000000 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json +++ /dev/null @@ -1,1098 +0,0 @@ -{ - "hints": [], - "groups": [], - "properties": [ - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.architecture", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.compiler", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.dump-directory", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.environment", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.logger", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.monitor", - "type": "org.apache.dubbo.config.MonitorConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.name", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.organization", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.owner", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.qos-accept-foreign-ip", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.qos-enable", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.qos-port", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.registries", - "type": "java.util.List" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.registry", - "type": "org.apache.dubbo.config.RegistryConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ApplicationConfig", - "name": "dubbo.application.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.applications", - "description": "Multiple {@link ApplicationConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.DubboConfigProperties", - "name": "dubbo.config.multiple", - "description": "Indicates multiple properties binding from externalized configuration or not.", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.DubboConfigProperties", - "name": "dubbo.config.override", - "description": "Indicates override {@link ConfigUtils#getProperties() Dubbo config properties} from externalized configuration\n or not.", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.actives", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.application", - "type": "org.apache.dubbo.config.ApplicationConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.async", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.cache", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.callbacks", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.check", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.client", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.cluster", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.connections", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.filter", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.generic", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.group", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.init", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "deprecated": true, - "name": "dubbo.consumer.injvm", - "type": "java.lang.Boolean", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.layer", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.lazy", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.listener", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.loadbalance", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "deprecated": true, - "name": "dubbo.consumer.local", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.merger", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.mock", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.module", - "type": "org.apache.dubbo.config.ModuleConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.monitor", - "type": "org.apache.dubbo.config.MonitorConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.onconnect", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.ondisconnect", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.owner", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.proxy", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.reconnect", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.registries", - "type": "java.util.List" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.registry", - "type": "org.apache.dubbo.config.RegistryConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.retries", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.scope", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.sent", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.sticky", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.stub", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.timeout", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.validation", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ConsumerConfig", - "name": "dubbo.consumer.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.consumers", - "description": "Multiple {@link ConsumerConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.monitor", - "type": "org.apache.dubbo.config.MonitorConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.name", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.organization", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.owner", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.registries", - "type": "java.util.List" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.registry", - "type": "org.apache.dubbo.config.RegistryConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ModuleConfig", - "name": "dubbo.module.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.modules", - "description": "Multiple {@link ModuleConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.address", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.group", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.password", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.protocol", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.username", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.MonitorConfig", - "name": "dubbo.monitor.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.monitors", - "description": "Multiple {@link MonitorConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.accepts", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.accesslog", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.buffer", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.charset", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.client", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.codec", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.contextpath", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.dispatcher", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "deprecated": true, - "name": "dubbo.protocol.dispather", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.exchanger", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.heartbeat", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.host", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.iothreads", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.name", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.networker", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "deprecated": true, - "name": "dubbo.protocol.path", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.payload", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.port", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.prompt", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.queues", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.register", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.serialization", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.server", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.status", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.telnet", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.threadpool", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.threads", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProtocolConfig", - "name": "dubbo.protocol.transporter", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.protocols", - "description": "Multiple {@link ProtocolConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.accepts", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.accesslog", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.actives", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.application", - "type": "org.apache.dubbo.config.ApplicationConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.async", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.buffer", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.cache", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.callbacks", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.charset", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.client", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.cluster", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.codec", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.connections", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.contextpath", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "deprecated": true, - "name": "dubbo.provider.default", - "type": "java.lang.Boolean", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.delay", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.deprecated", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.dispatcher", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "deprecated": true, - "name": "dubbo.provider.dispather", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.document", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.dynamic", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.exchanger", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.executes", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.export", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.filter", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.group", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.host", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.iothreads", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.layer", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.listener", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.loadbalance", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "deprecated": true, - "name": "dubbo.provider.local", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.merger", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.mock", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.module", - "type": "org.apache.dubbo.config.ModuleConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.monitor", - "type": "org.apache.dubbo.config.MonitorConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.networker", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.onconnect", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.ondisconnect", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.owner", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "deprecated": true, - "name": "dubbo.provider.path", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.payload", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "deprecated": true, - "name": "dubbo.provider.port", - "type": "java.lang.Integer", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.prompt", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.protocol", - "type": "org.apache.dubbo.config.ProtocolConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.protocols", - "type": "java.util.List" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.proxy", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.queues", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.register", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.registries", - "type": "java.util.List" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.registry", - "type": "org.apache.dubbo.config.RegistryConfig" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.retries", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.scope", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.sent", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.serialization", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.server", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.status", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.stub", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.telnet", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.threadpool", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.threads", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.timeout", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.token", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.transporter", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.validation", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.wait", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.warmup", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.ProviderConfig", - "name": "dubbo.provider.weight", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.providers", - "description": "Multiple {@link ProviderConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.MultipleDubboConfigBindingProperties", - "name": "dubbo.registries", - "description": "Multiple {@link RegistryConfig} property", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.address", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.check", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.client", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.cluster", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.default", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.dynamic", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.file", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.group", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.id", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.parameters", - "type": "java.util.Map" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.password", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.port", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.protocol", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.register", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.server", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.session", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.subscribe", - "type": "java.lang.Boolean" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.timeout", - "type": "java.lang.Integer" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "deprecated": true, - "name": "dubbo.registry.transport", - "type": "java.lang.String", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.transporter", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.username", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "name": "dubbo.registry.version", - "type": "java.lang.String" - }, - { - "sourceType": "org.apache.dubbo.config.RegistryConfig", - "deprecated": true, - "name": "dubbo.registry.wait", - "type": "java.lang.Integer", - "deprecation": {} - }, - { - "sourceType": "org.apache.dubbo.spring.boot.autoconfigure.DubboScanProperties", - "name": "dubbo.scan.base-packages", - "description": "The base-packages to scan , the multiple-value is delimited by comma\n\n @see EnableDubbo#scanBasePackages()", - "type": "java.util.Set" - } - ] -} \ No newline at end of file diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring.factories b/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring.factories index 08db894ac..e3005dba2 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring.factories +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/resources/META-INF/spring.factories @@ -6,4 +6,6 @@ org.apache.dubbo.spring.boot.context.event.OverrideDubboConfigApplicationListene org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener,\ org.apache.dubbo.spring.boot.context.event.AwaitingNonWebApplicationListener org.springframework.boot.env.EnvironmentPostProcessor=\ -org.apache.dubbo.spring.boot.env.DubboDefaultPropertiesEnvironmentPostProcessor \ No newline at end of file +org.apache.dubbo.spring.boot.env.DubboDefaultPropertiesEnvironmentPostProcessor +org.springframework.context.ApplicationContextInitializer=\ +org.apache.dubbo.spring.boot.context.DubboApplicationContextInitializer \ No newline at end of file diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java index 1addb5e78..ba4e0a40d 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java @@ -23,6 +23,7 @@ import org.apache.dubbo.config.ProtocolConfig; import org.apache.dubbo.config.ProviderConfig; import org.apache.dubbo.config.RegistryConfig; + import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -49,7 +50,6 @@ @TestPropertySource( properties = { "dubbo.applications.application1.NAME = dubbo-demo-application", - "dubbo.applications.application2.name = dubbo-demo-application2", "dubbo.modules.module1.name = dubbo-demo-module", "dubbo.registries.registry1.address = zookeeper://192.168.99.100:32770", "dubbo.protocols.protocol1.name=dubbo", @@ -155,7 +155,7 @@ public class DubboAutoConfigurationOnMultipleConfigTest { public void testMultipleDubboConfigBindingProperties() { - Assert.assertEquals(3, applications.size()); + Assert.assertEquals(1, applications.size()); Assert.assertEquals(1, modules.size()); @@ -179,7 +179,7 @@ public void testApplicationContext() { */ Map applications = beansOfTypeIncludingAncestors(applicationContext, ApplicationConfig.class); - Assert.assertEquals(3, applications.size()); + Assert.assertEquals(1, applications.size()); /** * Multiple {@link ModuleConfig} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessorTest.java b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessorTest.java new file mode 100644 index 000000000..a24ca146a --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/beans/factory/config/DubboConfigBeanDefinitionConflictProcessorTest.java @@ -0,0 +1,109 @@ +/* + * 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.boot.beans.factory.config; + +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.ImportResource; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.Ordered; + +import java.util.Map; + + +/** + * {@link DubboConfigBeanDefinitionConflictProcessor} Test + * + * @since 2.7.1 + */ +public class DubboConfigBeanDefinitionConflictProcessorTest { + + private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @Before + public void init() { + context.addBeanFactoryPostProcessor(new DubboConfigBeanDefinitionConflictProcessor()); + } + + @After + public void destroy() { + context.close(); + } + + @Test + public void testOrder() { + Assert.assertEquals(Ordered.LOWEST_PRECEDENCE, new DubboConfigBeanDefinitionConflictProcessor().getOrder()); + } + + @Test + public void testNormalCase() { + + System.setProperty("dubbo.application.name", "test-dubbo-application"); + + context.register(DubboConfig.class); + + context.refresh(); + + ApplicationConfig applicationConfig = context.getBean(ApplicationConfig.class); + + Assert.assertEquals("test-dubbo-application", applicationConfig.getName()); + } + + @Test + public void testDuplicatedConfigsCase() { + + context.register(PropertySourceConfig.class, DubboConfig.class); + + context.register(XmlConfig.class); + + context.refresh(); + + Map beansMap = context.getBeansOfType(ApplicationConfig.class); + + ApplicationConfig applicationConfig = beansMap.get("dubbo-consumer-2.7.x"); + + Assert.assertEquals(1, beansMap.size()); + + Assert.assertEquals("dubbo-consumer-2.7.x", applicationConfig.getName()); + } + + @Test(expected = IllegalStateException.class) + public void testFailedCase() { + context.register(ApplicationConfig.class); + testDuplicatedConfigsCase(); + } + + @EnableDubboConfig + static class DubboConfig { + + } + + @PropertySource("classpath:/META-INF/dubbo.properties") + static class PropertySourceConfig { + + } + + @ImportResource("classpath:/META-INF/spring/dubbo-context.xml") + static class XmlConfig { + } +} diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java index 7242b58af..823ddb7db 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java @@ -25,6 +25,10 @@ import static org.apache.dubbo.spring.boot.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME; import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE; import static org.apache.dubbo.spring.boot.util.DubboUtils.DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_APPLICATION_ID_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_APPLICATION_NAME_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_APPLICATION_QOS_ENABLE_PROPERTY; +import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_CONFIG_MULTIPLE_PROPERTY; import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_CONFIG_PREFIX; import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_GITHUB_URL; import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_MAILING_LIST; @@ -35,6 +39,7 @@ import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_SPRING_BOOT_ISSUES_URL; import static org.apache.dubbo.spring.boot.util.DubboUtils.MULTIPLE_CONFIG_PROPERTY_NAME; import static org.apache.dubbo.spring.boot.util.DubboUtils.OVERRIDE_CONFIG_FULL_PROPERTY_NAME; +import static org.apache.dubbo.spring.boot.util.DubboUtils.SPRING_APPLICATION_NAME_PROPERTY; import static org.apache.dubbo.spring.boot.util.DubboUtils.filterDubboProperties; /** @@ -68,10 +73,17 @@ public void testConstants() { Assert.assertEquals("dev@dubbo.apache.org", DUBBO_MAILING_LIST); + Assert.assertEquals("spring.application.name", SPRING_APPLICATION_NAME_PROPERTY); + Assert.assertEquals("dubbo.application.id", DUBBO_APPLICATION_ID_PROPERTY); + Assert.assertEquals("dubbo.application.name", DUBBO_APPLICATION_NAME_PROPERTY); + Assert.assertEquals("dubbo.application.qos-enable", DUBBO_APPLICATION_QOS_ENABLE_PROPERTY); + Assert.assertEquals("dubbo.config.multiple", DUBBO_CONFIG_MULTIPLE_PROPERTY); + Assert.assertTrue(DEFAULT_MULTIPLE_CONFIG_PROPERTY_VALUE); Assert.assertTrue(DEFAULT_OVERRIDE_CONFIG_PROPERTY_VALUE); + } diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/dubbo.properties b/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/dubbo.properties new file mode 100644 index 000000000..97633c54d --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/dubbo.properties @@ -0,0 +1 @@ +dubbo.application.id = test-dubbo-application-id \ No newline at end of file diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/spring/dubbo-context.xml b/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/spring/dubbo-context.xml new file mode 100644 index 000000000..87b6505cf --- /dev/null +++ b/dubbo-spring-boot-compatible/autoconfigure/src/test/resources/META-INF/spring/dubbo-context.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/dubbo-spring-boot-parent/pom.xml b/dubbo-spring-boot-parent/pom.xml index 9d7b1e8a9..085092010 100644 --- a/dubbo-spring-boot-parent/pom.xml +++ b/dubbo-spring-boot-parent/pom.xml @@ -38,11 +38,10 @@ 1.8 UTF-8 UTF-8 - 2.1.2.RELEASE - 2.7.0 + 2.1.3.RELEASE + ${revision} - -server -Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 - -Djava.net.preferIPv4Stack=true + -server -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true @@ -227,11 +226,10 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - -proc:none true ${java.source.version} ${java.target.version} - ${file.encoding} + ${project.build.sourceEncoding} diff --git a/dubbo-spring-boot-samples/auto-configure-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboAutoConfigurationConsumerBootstrap.java b/dubbo-spring-boot-samples/auto-configure-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboAutoConfigurationConsumerBootstrap.java index 5b2ac82eb..be83edf9e 100644 --- a/dubbo-spring-boot-samples/auto-configure-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboAutoConfigurationConsumerBootstrap.java +++ b/dubbo-spring-boot-samples/auto-configure-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboAutoConfigurationConsumerBootstrap.java @@ -44,8 +44,6 @@ public static void main(String[] args) { @Bean public ApplicationRunner runner() { - return args -> { - logger.info(demoService.sayHello("mercyblitz")); - }; + return args -> logger.info(demoService.sayHello("mercyblitz")); } } diff --git a/dubbo-spring-boot-samples/auto-configure-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java b/dubbo-spring-boot-samples/auto-configure-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java index 61195ac6d..325b19abf 100644 --- a/dubbo-spring-boot-samples/auto-configure-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java +++ b/dubbo-spring-boot-samples/auto-configure-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java @@ -35,6 +35,7 @@ public class DefaultDemoService implements DemoService { @Value("${dubbo.application.name}") private String serviceName; + @Override public String sayHello(String name) { return String.format("[%s] : Hello, %s", serviceName, name); } diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/pom.xml b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/pom.xml index 1941193ea..edaf3049c 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/pom.xml @@ -53,19 +53,12 @@ ${revision} + - org.apache.curator - curator-framework - - - - org.apache.curator - curator-recipes - - - - org.apache.zookeeper - zookeeper + org.apache.dubbo + dubbo-dependencies-zookeeper + ${dubbo.version} + pom diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboRegistryZooKeeperConsumerBootstrap.java b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboRegistryZooKeeperConsumerBootstrap.java index 3da78b1a1..81829ca3d 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboRegistryZooKeeperConsumerBootstrap.java +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboRegistryZooKeeperConsumerBootstrap.java @@ -18,7 +18,6 @@ import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.spring.boot.demo.consumer.DemoService; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.ApplicationRunner; @@ -43,8 +42,6 @@ public static void main(String[] args) { @Bean public ApplicationRunner runner() { - return args -> { - logger.info(demoService.sayHello("mercyblitz")); - }; + return args -> logger.info(demoService.sayHello("mercyblitz")); } } diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/resources/application.yml b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/resources/application.yml index 88846fbed..a533b4d60 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/resources/application.yml +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/consumer-sample/src/main/resources/application.yml @@ -12,4 +12,5 @@ embedded: dubbo: registry: - address: zookeeper://127.0.0.1:${embedded.zookeeper.port} \ No newline at end of file + address: zookeeper://127.0.0.1:${embedded.zookeeper.port} + file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/pom.xml b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/pom.xml index c41c446a5..8f1719afb 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/pom.xml @@ -55,20 +55,12 @@ ${revision} - + - org.apache.zookeeper - zookeeper - - - - org.apache.curator - curator-framework - - - - org.apache.curator - curator-recipes + org.apache.dubbo + dubbo-dependencies-zookeeper + ${dubbo.version} + pom diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java index 1758fc858..56ecea477 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java @@ -93,6 +93,7 @@ public EmbeddedZooKeeper() { * Construct an EmbeddedZooKeeper with the provided port. * * @param clientPort port for ZooKeeper server to bind to + * @param daemon is daemon or not thread. */ public EmbeddedZooKeeper(int clientPort, boolean daemon) { this.clientPort = clientPort; diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java index 6ff5f7ab1..bf5f80d99 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java @@ -35,6 +35,7 @@ public class DefaultDemoService implements DemoService { @Value("${dubbo.application.name}") private String serviceName; + @Override public String sayHello(String name) { return String.format("[%s] : Hello, %s", serviceName, name); } diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties index d66c19dea..0c9116cdd 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties @@ -16,6 +16,7 @@ dubbo.protocol.port=-1 ## Dubbo Registry dubbo.registry.address=zookeeper://127.0.0.1:${embedded.zookeeper.port} +dubbo.registry.file = ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache ## DemoService version demo.service.version=1.0.0 \ No newline at end of file diff --git a/dubbo-spring-boot-samples/externalized-configuration-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboExternalizedConfigurationConsumerBootstrap.java b/dubbo-spring-boot-samples/externalized-configuration-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboExternalizedConfigurationConsumerBootstrap.java index f36ec2b6c..39f75b826 100644 --- a/dubbo-spring-boot-samples/externalized-configuration-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboExternalizedConfigurationConsumerBootstrap.java +++ b/dubbo-spring-boot-samples/externalized-configuration-samples/consumer-sample/src/main/java/org/apache/dubbo/spring/boot/demo/consumer/bootstrap/DubboExternalizedConfigurationConsumerBootstrap.java @@ -51,8 +51,6 @@ public String sayHello(@RequestParam String name) { @Bean public ApplicationRunner runner() { - return args -> { - logger.info(demoService.sayHello("mercyblitz")); - }; + return args -> logger.info(demoService.sayHello("mercyblitz")); } } diff --git a/dubbo-spring-boot-samples/externalized-configuration-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java b/dubbo-spring-boot-samples/externalized-configuration-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java index 6ff5f7ab1..bf5f80d99 100644 --- a/dubbo-spring-boot-samples/externalized-configuration-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java +++ b/dubbo-spring-boot-samples/externalized-configuration-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/service/DefaultDemoService.java @@ -35,6 +35,7 @@ public class DefaultDemoService implements DemoService { @Value("${dubbo.application.name}") private String serviceName; + @Override public String sayHello(String name) { return String.format("[%s] : Hello, %s", serviceName, name); } diff --git a/pom.xml b/pom.xml index ffefee6a9..e8d9e32f9 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 3.0.1 2.19.1 - 2.7.0 + 2.7.1-SNAPSHOT @@ -114,6 +114,7 @@ + org.apache.maven.plugins maven-gpg-plugin @@ -126,6 +127,7 @@ + org.codehaus.mojo flatten-maven-plugin @@ -151,9 +153,40 @@ + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.1.0 + + true + resolveCiFriendliesOnly + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + + \ No newline at end of file