This is an automated email from the ASF dual-hosted git repository. mercyblitz pushed a commit to branch 0.2.0 in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-spring-boot-project.git
The following commit(s) were added to refs/heads/0.2.0 by this push: new 45813e4 Polish #78 #57 #37 45813e4 is described below commit 45813e4630948b8834e4f0ec9f6387676bdf7350 Author: mercyblitz <mercybl...@gmail.com> AuthorDate: Wed Mar 28 00:12:28 2018 +0800 Polish #78 #57 #37 --- dubbo-spring-boot-actuator/JMX_HealthEndpoint.png | Bin 284819 -> 230227 bytes dubbo-spring-boot-actuator/README.md | 109 +- .../DubboEndpointsAutoConfiguration.java | 83 ++ .../DubboHealthIndicatorAutoConfiguration.java | 4 +- ...oMvcEndpointManagementContextConfiguration.java | 49 - .../actuate/endpoint/AbstractDubboEndpoint.java | 123 +++ .../endpoint/DubboConfigsMetadataEndpoint.java | 79 ++ .../boot/dubbo/actuate/endpoint/DubboEndpoint.java | 35 +- .../DubboPropertiesEndpoint.java} | 35 +- .../endpoint/DubboReferencesMetadataEndpoint.java | 73 ++ .../endpoint/DubboServicesMetadataEndpoint.java | 86 ++ .../actuate/endpoint/DubboShutdownEndpoint.java | 82 ++ .../actuate/endpoint/mvc/DubboMvcEndpoint.java | 459 -------- .../META-INF/dubbo-web-endpoins-default.properties | 22 + .../src/main/resources/META-INF/spring.factories | 7 +- .../dubbo/actuate/endpoint/DubboEndpointTest.java | 9 - ...va => DubboEndpointsAutoConfigurationTest.java} | 72 +- .../actuate/endpoint/mvc/DubboMvcEndpointTest.java | 380 +++---- .../autoconfigure/DubboAutoConfiguration.java | 11 +- .../autoconfigure/RelaxedDubboConfigBinder.java | 50 +- .../event/AwaitingNonWebApplicationListener.java | 3 +- .../event/WelcomeLogoApplicationListener.java | 2 +- .../META-INF/spring-configuration-metadata.json | 1098 ++++++++++++++++++++ dubbo-spring-boot-parent/pom.xml | 4 +- .../dubbo-spring-boot-sample-consumer/pom.xml | 8 +- .../src/main/resources/application.properties | 16 +- .../dubbo-spring-boot-sample-provider/pom.xml | 8 +- .../demo/provider/bootstrap/DubboProviderDemo.java | 3 +- .../src/main/resources/application.properties | 2 - dubbo-spring-boot-starter/pom.xml | 6 +- 30 files changed, 2031 insertions(+), 887 deletions(-) diff --git a/dubbo-spring-boot-actuator/JMX_HealthEndpoint.png b/dubbo-spring-boot-actuator/JMX_HealthEndpoint.png index 7975cd8..18e9f92 100644 Binary files a/dubbo-spring-boot-actuator/JMX_HealthEndpoint.png and b/dubbo-spring-boot-actuator/JMX_HealthEndpoint.png differ diff --git a/dubbo-spring-boot-actuator/README.md b/dubbo-spring-boot-actuator/README.md index 39d8c41..ac020f3 100644 --- a/dubbo-spring-boot-actuator/README.md +++ b/dubbo-spring-boot-actuator/README.md @@ -21,7 +21,7 @@ You can introduce the latest `dubbo-spring-boot-actuator` to your project by ad <dependency> <groupId>com.alibaba.boot</groupId> <artifactId>dubbo-spring-boot-actuator</artifactId> - <version>0.1.1</version> + <version>0.2.0</version> </dependency> ``` If your project failed to resolve the dependency, try to add the following repository: @@ -48,11 +48,11 @@ If your project failed to resolve the dependency, try to add the following repos -### MVC Endpoint : `/health` +### Web Endpoint : `/health` -Suppose a Spring Boot Web application did not specify `management.port`, you can access http://localhost:8080/health via Web Client and will get a response with JSON format is like below : +Suppose a Spring Boot Web application did not specify `management.server.port`, you can access http://localhost:8080/actuator/health via Web Client and will get a response with JSON format is like below : ```json { @@ -96,21 +96,24 @@ Suppose a Spring Boot Web application did not specify `management.port`, you can } ``` -In [samples](../dubbo-spring-boot-samples/) , `/health` MVC Endpoints are exposed on http://localhost:9091/health ([provider](../dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider)) and http://localhost:8081/health ([consumer](../dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer)) +In [samples](../dubbo-spring-boot-samples/) , `/health` Web Endpoints are exposed on http://localhost:8081/health +([consumer](../dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer)) - `memory`, `load`, `threadpool` and `server` are Dubbo's build-in `StatusChecker`s in above example. Dubbo allows the application to extend `StatusChecker`'s SPI. + `memory`, `load`, `threadpool` and `server` are Dubbo's build-in `StatusChecker`s in above example. + Dubbo allows the application to extend `StatusChecker`'s SPI. -Default , `memory` and `load` will be added into Dubbo's `HealthIndicator` , it could be overridden by externalized configuration [`StatusChecker`'s defaults](#statuschecker-defaults). +Default , `memory` and `load` will be added into Dubbo's `HealthIndicator` , it could be overridden by +externalized configuration [`StatusChecker`'s defaults](#statuschecker-defaults). -### JMX Endpoint : `healthEndpoint` +### JMX Endpoint : `Health` -`healthEndpoint` is a JMX (Java Management Extensions) Endpoint with ObjectName `org.springframework.boot:type=Endpoint,name=healthEndpoint` , it can be managed by JMX agent ,e.g. JDK tools : `jconsole` and so on. +`Health` is a JMX (Java Management Extensions) Endpoint with ObjectName `org.springframework.boot:type=Endpoint,name=Health` , it can be managed by JMX agent ,e.g. JDK tools : `jconsole` and so on. ![](JMX_HealthEndpoint.png) @@ -142,20 +145,26 @@ The property key that is name of `StatusChecker` can be a valid value of `manag -Actuator endpoint `dubbo` supports Spring Web MVC Endpoints : +Actuator endpoint `dubbo` supports Actuator Endpoints : -| URI | HTTP Method | Description | Content Type | -| ------------------- | ----------- | ----------------------------------- | ------------------ | -| `/dubbo` | `GET` | Exposes Dubbo's meta data | `application/json` | -| `/dubbo/properties` | `GET` | Exposes all Dubbo's Properties | `application/json` | -| `/dubbo/services` | `GET` | Exposes all Dubbo's `ServiceBean` | `application/json` | -| `/dubbo/references` | `GET` | Exposes all Dubbo's `ReferenceBean` | `application/json` | -| `/dubbo/configs` | `GET` | Exposes all Dubbo's `*Config` | `application/json` | -| `/dubbo/shutdown` | `POST` | Shutdown Dubbo services | `application/json` | +| ID | Enabled | HTTP URI | HTTP Method | Description | Content Type | +| ------------------- | ----------- | ----------------------------------- | ------------------ | ------------------ | ------------------ | +| `dubbo` | `true` | `/actuator/dubbo` | `GET` | Exposes Dubbo's meta data | `application/json` | +| `dubbo-properties` | `true` | `/actuator/dubbo/properties` | `GET` | Exposes all Dubbo's Properties | `application/json` | +| `dubbo-services` | `false` | `/dubbo/services` | `GET` | Exposes all Dubbo's `ServiceBean` | `application/json` | +| `dubbo-references` | `false` | `/actuator/dubbo/references` | `GET` | Exposes all Dubbo's `ReferenceBean` | `application/json` | +| `dubbo-configs` | `true` | `/actuator/dubbo/configs` | `GET` | Exposes all Dubbo's `*Config` | `application/json` | +| `dubbo-shutdown` | `false` | `/actuator/dubbo/shutdown` | `POST` | Shutdown Dubbo services | `application/json` | -### Endpoint : `/dubbo` + + +### Web Endpoints + + + +#### `/actuator/dubbo` `/dubbo` exposes Dubbo's meta data : @@ -172,24 +181,15 @@ Actuator endpoint `dubbo` supports Spring Web MVC Endpoints : "github": "https://github.com/dubbo/dubbo-spring-boot-project", "issues": "https://github.com/dubbo/dubbo-spring-boot-project/issues", "git": "https://github.com/dubbo/dubbo-spring-boot-project.git" - }, - "endpoints": { - "shutdown": "/shutdown", - "configs": "/configs", - "services": "/services", - "references": "/references", - "properties": "/properties" } } ``` +### +#### `/actuator/dubbo/properties` - - -### Endpoint : `/dubbo/properties` - -`/dubbo/properties` exposes all Dubbo's Properties from Spring Boot Externalized Configuration (a.k.a `PropertySources`) : +`/actuator/dubbo/properties` exposes all Dubbo's Properties from Spring Boot Externalized Configuration (a.k.a `PropertySources`) : ```json { @@ -212,9 +212,9 @@ The structure of JSON is simple Key-Value format , the key is property name as a -### Endpoint : `/dubbo/services` +#### `/actuator/dubbo/services` -`/dubbo/services` exposes all Dubbo's `ServiceBean` that are declared via `<dubbo:service/>` or `@Service` present in Spring `ApplicationContext` : +`/actuator/dubbo/services` exposes all Dubbo's `ServiceBean` that are declared via `<dubbo:service/>` or `@Service` present in Spring `ApplicationContext` : ```json { @@ -269,9 +269,9 @@ The key is the Bean name of `ServiceBean` , `ServiceBean`'s properties compose v -### Endpoint : `/dubbo/references` +#### `/actuator/dubbo/references` -`/dubbo/references` exposes all Dubbo's `ReferenceBean` that are declared via `@Reference` annotating on `Field` or `Method ` : +`/actuator/dubbo/references` exposes all Dubbo's `ReferenceBean` that are declared via `@Reference` annotating on `Field` or `Method ` : ```json { @@ -322,13 +322,13 @@ The key is the Bean name of `ServiceBean` , `ServiceBean`'s properties compose v } ``` -The key is the string presentation of `@Reference` `Field` or `Method ` , `ReferenceBean`'s properties compose value. +The key is the string presentation of `@Reference` `Field` or `Method ` , `ReferenceBean`'s properties compose value. -### Endpoint : `/dubbo/configs` +#### `/actuator/dubbo/configs` - `/dubbo/configs` exposes all Dubbo's `*Config` : + `/actuator/dubbo/configs` exposes all Dubbo's `*Config` : ```json { @@ -411,9 +411,9 @@ The key is the simple name of Dubbo `*Config` Class , the value is`*Config` Bea -### Endpoint : `/dubbo/shutdown` +#### `/actuator/dubbo/shutdown` -`/dubbo/shutdown` shutdowns Dubbo's components including registries, protocols, services and references : +`/actuator/dubbo/shutdown` shutdowns Dubbo's components including registries, protocols, services and references : ```json { @@ -486,30 +486,15 @@ management.health.dubbo.enabled = false -Dubbo Spring Boot providers actuator endpoint `dubbo` , however it is disable. If you'd like to enable it , please add following property into externalized configuration : - -```properties -# Dubbo Endpoint enabled (default value is false) -endpoints.dubbo.enabled = true -``` - - - -### Endpoints Sensitive - -Dubbo endpoints contain some sensitive information and significant opeations , thus it's sensitive , that means endpoints maybe protected and authorized if security resolved. - - - -If you consider it's fine to be public , you can add following property into externalized configuration : +Dubbo Spring Boot providers actuator endpoints , however some of them are disable. If you'd like to enable them , please add following properties into externalized configuration : ```properties -# Dubbo Endpoint (default value is true) -endpoints.dubbo.sensitive = false +# Enables Dubbo All Endpoints +management.endpoint.dubbo.enabled = true +management.endpoint.dubbo-shutdown.enabled = true +management.endpoint.dubbo-configs.enabled = true +management.endpoint.dubbo-services.enabled = true +management.endpoint.dubbo-references.enabled = true +management.endpoint.dubbo-properties.enabled = true ``` -> If Spring Security were resolved , configure more : -> -> ```properties -> management.security.enabled = false -> ``` diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointsAutoConfiguration.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointsAutoConfiguration.java new file mode 100644 index 0000000..8cb2961 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointsAutoConfiguration.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 com.alibaba.boot.dubbo.actuate.autoconfigure; + +import com.alibaba.boot.dubbo.actuate.endpoint.*; +import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +/** + * Dubbo {@link Endpoint} Auto-{@link Configuration} + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @see Endpoint + * @see Configuration + * @since 0.2.0 + */ +@Configuration +@PropertySource( + name = "Dubbo Web Endpoints Default Properties", + value = "classpath:/META-INF/dubbo-web-endpoins-default.properties") +public class DubboEndpointsAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboEndpoint dubboEndpoint() { + return new DubboEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboConfigsMetadataEndpoint dubboConfigsMetadataEndpoint() { + return new DubboConfigsMetadataEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboPropertiesEndpoint dubboPropertiesEndpoint() { + return new DubboPropertiesEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboReferencesMetadataEndpoint dubboReferencesMetadataEndpoint() { + return new DubboReferencesMetadataEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboServicesMetadataEndpoint dubboServicesMetadataEndpoint() { + return new DubboServicesMetadataEndpoint(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnEnabledEndpoint + public DubboShutdownEndpoint dubboShutdownEndpoint() { + return new DubboShutdownEndpoint(); + } + +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboHealthIndicatorAutoConfiguration.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboHealthIndicatorAutoConfiguration.java index 8dc9892..c53c958 100644 --- a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboHealthIndicatorAutoConfiguration.java +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboHealthIndicatorAutoConfiguration.java @@ -19,8 +19,8 @@ package com.alibaba.boot.dubbo.actuate.autoconfigure; import com.alibaba.boot.dubbo.actuate.health.DubboHealthIndicator; import com.alibaba.boot.dubbo.actuate.health.DubboHealthIndicatorProperties; import com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.ConditionalOnEnabledHealthIndicator; -import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration; +import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboMvcEndpointManagementContextConfiguration.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboMvcEndpointManagementContextConfiguration.java deleted file mode 100644 index 18a44a1..0000000 --- a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboMvcEndpointManagementContextConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 com.alibaba.boot.dubbo.actuate.autoconfigure; - -import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; -import com.alibaba.boot.dubbo.actuate.endpoint.mvc.DubboMvcEndpoint; -import com.alibaba.dubbo.config.annotation.Service; -import org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration; -import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter; -import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.context.annotation.Bean; - -/** - * Dubbo {@link MvcEndpoint} {@link ManagementContextConfiguration} - * - * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> - * @see - * @since 1.0.0 - */ -@ManagementContextConfiguration -@ConditionalOnClass({Service.class, EndpointMvcAdapter.class}) -@ConditionalOnWebApplication -public class DubboMvcEndpointManagementContextConfiguration { - - @Bean - @ConditionalOnMissingBean - public DubboMvcEndpoint dubboMvcEndpoint(DubboEndpoint dubboEndpoint) { - return new DubboMvcEndpoint(dubboEndpoint); - } - - -} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/AbstractDubboEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/AbstractDubboEndpoint.java new file mode 100644 index 0000000..05f5bed --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/AbstractDubboEndpoint.java @@ -0,0 +1,123 @@ +/* + * 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 com.alibaba.boot.dubbo.actuate.endpoint; + +import com.alibaba.dubbo.config.ProtocolConfig; +import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.EnvironmentAware; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.Environment; + +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.URL; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.BEAN_NAME; +import static org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors; +import static org.springframework.util.ClassUtils.isPrimitiveOrWrapper; + +/** + * Abstract Dubbo {@link @Endpoint} + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @since 0.2.0 + */ +public abstract class AbstractDubboEndpoint implements ApplicationContextAware, EnvironmentAware { + + protected ApplicationContext applicationContext; + + protected ConfigurableEnvironment environment; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + @Override + public void setEnvironment(Environment environment) { + if (environment instanceof ConfigurableEnvironment) { + this.environment = (ConfigurableEnvironment) environment; + } + } + + protected Map<String, Object> resolveBeanMetadata(final Object bean) { + + final Map<String, Object> beanMetadata = new LinkedHashMap<>(); + + try { + + BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + + Method readMethod = propertyDescriptor.getReadMethod(); + + if (readMethod != null && isSimpleType(propertyDescriptor.getPropertyType())) { + + String name = Introspector.decapitalize(propertyDescriptor.getName()); + Object value = readMethod.invoke(bean); + + beanMetadata.put(name, value); + } + + } + + } catch (Exception e) { + throw new RuntimeException(e); + } + + return beanMetadata; + + } + + protected Map<String, ServiceBean> getServiceBeansMap() { + return beansOfTypeIncludingAncestors(applicationContext, ServiceBean.class); + } + + protected ReferenceAnnotationBeanPostProcessor getReferenceAnnotationBeanPostProcessor() { + return applicationContext.getBean(BEAN_NAME, ReferenceAnnotationBeanPostProcessor.class); + } + + protected Map<String, ProtocolConfig> getProtocolConfigsBeanMap() { + return beansOfTypeIncludingAncestors(applicationContext, ProtocolConfig.class); + } + + private static boolean isSimpleType(Class<?> type) { + return isPrimitiveOrWrapper(type) + || type == String.class + || type == BigDecimal.class + || type == BigInteger.class + || type == Date.class + || type == URL.class + || type == Class.class + ; + } + + +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboConfigsMetadataEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboConfigsMetadataEndpoint.java new file mode 100644 index 0000000..b5ae637 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboConfigsMetadataEndpoint.java @@ -0,0 +1,79 @@ +/* + * 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 com.alibaba.boot.dubbo.actuate.endpoint; + +import com.alibaba.dubbo.config.*; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.TreeMap; + +import static org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors; + +/** + * Dubbo Configs Metadata {@link Endpoint} + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @since 0.2.0 + */ +@Endpoint(id = "dubbo-configs") +public class DubboConfigsMetadataEndpoint extends AbstractDubboEndpoint { + + @ReadOperation + public Map<String, Map<String, Map<String, Object>>> configs() { + + Map<String, Map<String, Map<String, Object>>> configsMap = new LinkedHashMap<>(); + + addDubboConfigBeans(ApplicationConfig.class, configsMap); + addDubboConfigBeans(ConsumerConfig.class, configsMap); + addDubboConfigBeans(MethodConfig.class, configsMap); + addDubboConfigBeans(ModuleConfig.class, configsMap); + addDubboConfigBeans(MonitorConfig.class, configsMap); + addDubboConfigBeans(ProtocolConfig.class, configsMap); + addDubboConfigBeans(ProviderConfig.class, configsMap); + addDubboConfigBeans(ReferenceConfig.class, configsMap); + addDubboConfigBeans(RegistryConfig.class, configsMap); + addDubboConfigBeans(ServiceConfig.class, configsMap); + + return configsMap; + + } + + private void addDubboConfigBeans(Class<? extends AbstractConfig> dubboConfigClass, + Map<String, Map<String, Map<String, Object>>> configsMap) { + + Map<String, ? extends AbstractConfig> dubboConfigBeans = beansOfTypeIncludingAncestors(applicationContext, dubboConfigClass); + + String name = dubboConfigClass.getSimpleName(); + + Map<String, Map<String, Object>> beansMetadata = new TreeMap<>(); + + for (Map.Entry<String, ? extends AbstractConfig> entry : dubboConfigBeans.entrySet()) { + + String beanName = entry.getKey(); + AbstractConfig configBean = entry.getValue(); + Map<String, Object> configBeanMeta = resolveBeanMetadata(configBean); + beansMetadata.put(beanName, configBeanMeta); + + } + + configsMap.put(name, beansMetadata); + + } +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpoint.java index 9a857f5..a213d2d 100644 --- a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpoint.java +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpoint.java @@ -18,13 +18,13 @@ package com.alibaba.boot.dubbo.actuate.endpoint; import com.alibaba.boot.dubbo.util.DubboUtils; import com.alibaba.dubbo.common.Version; -import org.springframework.boot.actuate.endpoint.AbstractEndpoint; -import org.springframework.boot.actuate.endpoint.Endpoint; -import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import java.util.LinkedHashMap; import java.util.Map; +import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_ENDPOINT_ID; import static com.alibaba.boot.dubbo.util.DubboUtils.*; /** @@ -34,24 +34,22 @@ import static com.alibaba.boot.dubbo.util.DubboUtils.*; * @see Endpoint * @since 1.0.0 */ -@ConfigurationProperties(prefix = "endpoints.dubbo", ignoreUnknownFields = false) -public class DubboEndpoint extends AbstractEndpoint<Map<String, Object>> { +@Endpoint(id = DUBBO_ENDPOINT_ID) +public class DubboEndpoint { - public static final String DUBBO_SHUTDOWN_ENDPOINT_URI = "/shutdown"; + public static final String DUBBO_ENDPOINT_ID = "dubbo"; - public static final String DUBBO_CONFIGS_ENDPOINT_URI = "/configs"; + public static final String DUBBO_SHUTDOWN_ENDPOINT_ID = DUBBO_ENDPOINT_ID + "-shutdown"; - public static final String DUBBO_SERVICES_ENDPOINT_URI = "/services"; + public static final String DUBBO_CONFIGS_ENDPOINT_ID = DUBBO_ENDPOINT_ID + "-configs"; - public static final String DUBBO_REFERENCES_ENDPOINT_URI = "/references"; + public static final String DUBBO_SERVICES_ENDPOINT_ID = DUBBO_ENDPOINT_ID + "-services"; - public static final String DUBBO_PROPERTIES_ENDPOINT_URI = "/properties"; + public static final String DUBBO_REFERENCES_ENDPOINT_ID = DUBBO_ENDPOINT_ID + "-references"; - public DubboEndpoint() { - super("dubbo", true, false); - } + public static final String DUBBO_PROPERTIES_ENDPOINT_ID = DUBBO_ENDPOINT_ID + "-properties"; - @Override + @ReadOperation public Map<String, Object> invoke() { Map<String, Object> metaData = new LinkedHashMap<>(); @@ -69,17 +67,10 @@ public class DubboEndpoint extends AbstractEndpoint<Map<String, Object>> { urls.put("issues", DUBBO_SPRING_BOOT_ISSUES_URL); urls.put("git", DUBBO_SPRING_BOOT_GIT_URL); - Map<String, String> endpoints = new LinkedHashMap<>(); - endpoints.put("shutdown", DUBBO_SHUTDOWN_ENDPOINT_URI); - endpoints.put("configs", DUBBO_CONFIGS_ENDPOINT_URI); - endpoints.put("services", DUBBO_SERVICES_ENDPOINT_URI); - endpoints.put("references", DUBBO_REFERENCES_ENDPOINT_URI); - endpoints.put("properties", DUBBO_PROPERTIES_ENDPOINT_URI); - metaData.put("versions", versions); metaData.put("urls", urls); - metaData.put("endpoints", endpoints); return metaData; } + } diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointAutoConfiguration.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboPropertiesEndpoint.java similarity index 53% rename from dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointAutoConfiguration.java rename to dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboPropertiesEndpoint.java index 61ff57f..eeec4c9 100644 --- a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/autoconfigure/DubboEndpointAutoConfiguration.java +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboPropertiesEndpoint.java @@ -14,31 +14,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.boot.dubbo.actuate.autoconfigure; +package com.alibaba.boot.dubbo.actuate.endpoint; -import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; -import com.alibaba.dubbo.config.annotation.Service; -import org.springframework.boot.actuate.endpoint.Endpoint; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; + +import java.util.SortedMap; + +import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_PROPERTIES_ENDPOINT_ID; +import static com.alibaba.boot.dubbo.util.DubboUtils.filterDubboProperties; /** - * Dubbo {@link Endpoint} Auto Configuration + * Dubbo Properties {@link Endpoint} * * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> - * @see DubboEndpoint * @since 1.0.0 */ -@Configuration -@ConditionalOnClass({Service.class, Endpoint.class}) -public class DubboEndpointAutoConfiguration { - - @Bean - @ConditionalOnMissingBean - public DubboEndpoint dubboEndpoint() { - return new DubboEndpoint(); +@Endpoint(id = DUBBO_PROPERTIES_ENDPOINT_ID) +public class DubboPropertiesEndpoint extends AbstractDubboEndpoint { + + @ReadOperation + public SortedMap<String, Object> properties() { + + return filterDubboProperties(environment); + } } diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboReferencesMetadataEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboReferencesMetadataEndpoint.java new file mode 100644 index 0000000..649b066 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboReferencesMetadataEndpoint.java @@ -0,0 +1,73 @@ +/* + * 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 com.alibaba.boot.dubbo.actuate.endpoint; + +import com.alibaba.dubbo.config.annotation.Reference; +import com.alibaba.dubbo.config.spring.ReferenceBean; +import com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; +import org.springframework.beans.factory.annotation.InjectionMetadata; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Dubbo {@link Reference} Metadata {@link Endpoint} + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @since 1.0.0 + */ +@Endpoint(id = "dubbo-references") +public class DubboReferencesMetadataEndpoint extends AbstractDubboEndpoint { + + @ReadOperation + public Map<String, Map<String, Object>> references() { + + Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>(); + + ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor(); + + referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedFieldReferenceBeanMap())); + referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedMethodReferenceBeanMap())); + + return referencesMetadata; + + } + + private Map<String, Map<String, Object>> buildReferencesMetadata( + Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap) { + Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>(); + + for (Map.Entry<InjectionMetadata.InjectedElement, ReferenceBean<?>> entry : + injectedElementReferenceBeanMap.entrySet()) { + + InjectionMetadata.InjectedElement injectedElement = entry.getKey(); + + ReferenceBean<?> referenceBean = entry.getValue(); + + Map<String, Object> beanMetadata = resolveBeanMetadata(referenceBean); + beanMetadata.put("invoker", resolveBeanMetadata(referenceBean.get())); + + referencesMetadata.put(String.valueOf(injectedElement.getMember()), beanMetadata); + + } + + return referencesMetadata; + } + +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboServicesMetadataEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboServicesMetadataEndpoint.java new file mode 100644 index 0000000..4b36484 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboServicesMetadataEndpoint.java @@ -0,0 +1,86 @@ +/* + * 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 com.alibaba.boot.dubbo.actuate.endpoint; + +import com.alibaba.dubbo.config.annotation.Service; +import com.alibaba.dubbo.config.spring.ServiceBean; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Dubbo {@link Service} Metadata {@link Endpoint} + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @since 0.2.0 + */ +@Endpoint(id = "dubbo-services") +public class DubboServicesMetadataEndpoint extends AbstractDubboEndpoint { + + @ReadOperation + public Map<String, Map<String, Object>> services() { + + Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap(); + + Map<String, Map<String, Object>> servicesMetadata = new LinkedHashMap<>(serviceBeansMap.size()); + + for (Map.Entry<String, ServiceBean> entry : serviceBeansMap.entrySet()) { + + String serviceBeanName = entry.getKey(); + + ServiceBean serviceBean = entry.getValue(); + + Map<String, Object> serviceBeanMetadata = resolveBeanMetadata(serviceBean); + + Object service = resolveServiceBean(serviceBeanName, serviceBean); + + if (service != null) { + // Add Service implementation class + serviceBeanMetadata.put("serviceClass", service.getClass().getName()); + } + + servicesMetadata.put(serviceBeanName, serviceBeanMetadata); + + } + + return servicesMetadata; + + } + + private Object resolveServiceBean(String serviceBeanName, ServiceBean serviceBean) { + + int index = serviceBeanName.indexOf("#"); + + if (index > -1) { + + Class<?> interfaceClass = serviceBean.getInterfaceClass(); + + String serviceName = serviceBeanName.substring(index + 1); + + if (applicationContext.containsBean(serviceName)) { + return applicationContext.getBean(serviceName, interfaceClass); + } + + } + + return null; + + } + +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboShutdownEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboShutdownEndpoint.java new file mode 100644 index 0000000..e2af718 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboShutdownEndpoint.java @@ -0,0 +1,82 @@ +/* + * 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 com.alibaba.boot.dubbo.actuate.endpoint; + +import com.alibaba.dubbo.config.ProtocolConfig; +import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; +import org.springframework.boot.actuate.endpoint.annotation.Endpoint; +import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.TreeMap; + +import static com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistries; + +/** + * Dubbo Shutdown + * + * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @since 0.2.0 + */ +@Endpoint(id = "dubbo-shutdown") +public class DubboShutdownEndpoint extends AbstractDubboEndpoint { + + + @WriteOperation + public Map<String, Object> shutdown() throws Exception { + + Map<String, Object> shutdownCountData = new LinkedHashMap<>(); + + // registries + int registriesCount = getRegistries().size(); + + // protocols + int protocolsCount = getProtocolConfigsBeanMap().size(); + + ProtocolConfig.destroyAll(); + shutdownCountData.put("registries", registriesCount); + shutdownCountData.put("protocols", protocolsCount); + + // Service Beans + Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap(); + if (!serviceBeansMap.isEmpty()) { + for (ServiceBean serviceBean : serviceBeansMap.values()) { + serviceBean.destroy(); + } + } + shutdownCountData.put("services", serviceBeansMap.size()); + + // Reference Beans + ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor(); + + int referencesCount = beanPostProcessor.getReferenceBeans().size(); + + beanPostProcessor.destroy(); + + shutdownCountData.put("references", referencesCount); + + // Set Result to complete + Map<String, Object> shutdownData = new TreeMap<>(); + shutdownData.put("shutdown.count", shutdownCountData); + + + return shutdownCountData; + } + +} diff --git a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpoint.java b/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpoint.java deleted file mode 100644 index 125cd34..0000000 --- a/dubbo-spring-boot-actuator/src/main/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpoint.java +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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 com.alibaba.boot.dubbo.actuate.endpoint.mvc; - -import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; -import com.alibaba.dubbo.config.*; -import com.alibaba.dubbo.config.annotation.Reference; -import com.alibaba.dubbo.config.spring.ReferenceBean; -import com.alibaba.dubbo.config.spring.ServiceBean; -import com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.InjectionMetadata; -import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter; -import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.EnvironmentAware; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.http.MediaType; -import org.springframework.util.ReflectionUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.context.request.async.DeferredResult; - -import java.beans.BeanInfo; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Field; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.net.URL; -import java.util.*; -import java.util.concurrent.ConcurrentMap; - -import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.*; -import static com.alibaba.boot.dubbo.util.DubboUtils.filterDubboProperties; -import static com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.BEAN_NAME; -import static com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistries; -import static org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors; -import static org.springframework.util.ClassUtils.isPrimitiveOrWrapper; - -/** - * {@link MvcEndpoint} to expose Dubbo Metadata - * - * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> - * @see - * @since 1.0.0 - */ -public class DubboMvcEndpoint extends EndpointMvcAdapter implements ApplicationContextAware, EnvironmentAware { - - private final Logger logger = LoggerFactory.getLogger(getClass()); - - private ApplicationContext applicationContext; - - private ConfigurableEnvironment environment; - - public DubboMvcEndpoint(DubboEndpoint dubboEndpoint) { - super(dubboEndpoint); - } - - - @RequestMapping(value = DUBBO_SHUTDOWN_ENDPOINT_URI, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public DeferredResult shutdown() throws Exception { - - DeferredResult result = new DeferredResult(); - - Map<String, Object> shutdownCountData = new LinkedHashMap<>(); - - // registries - int registriesCount = getRegistries().size(); - - // protocols - int protocolsCount = getProtocolConfigsBeanMap().size(); - - ProtocolConfig.destroyAll(); - shutdownCountData.put("registries", registriesCount); - shutdownCountData.put("protocols", protocolsCount); - - // Service Beans - Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap(); - if (!serviceBeansMap.isEmpty()) { - for (ServiceBean serviceBean : serviceBeansMap.values()) { - serviceBean.destroy(); - } - } - shutdownCountData.put("services", serviceBeansMap.size()); - - // Reference Beans - ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor(); - - int referencesCount = beanPostProcessor.getReferenceBeans().size(); - - beanPostProcessor.destroy(); - - shutdownCountData.put("references", referencesCount); - - // Set Result to complete - Map<String, Object> shutdownData = new TreeMap<>(); - shutdownData.put("shutdown.count", shutdownCountData); - result.setResult(shutdownData); - - return result; - - } - - @RequestMapping(value = DUBBO_CONFIGS_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public Map<String, Map<String, Map<String, Object>>> configs() { - - Map<String, Map<String, Map<String, Object>>> configsMap = new LinkedHashMap<>(); - - addDubboConfigBeans(ApplicationConfig.class, configsMap); - addDubboConfigBeans(ConsumerConfig.class, configsMap); - addDubboConfigBeans(MethodConfig.class, configsMap); - addDubboConfigBeans(ModuleConfig.class, configsMap); - addDubboConfigBeans(MonitorConfig.class, configsMap); - addDubboConfigBeans(ProtocolConfig.class, configsMap); - addDubboConfigBeans(ProviderConfig.class, configsMap); - addDubboConfigBeans(ReferenceConfig.class, configsMap); - addDubboConfigBeans(RegistryConfig.class, configsMap); - addDubboConfigBeans(ServiceConfig.class, configsMap); - - return configsMap; - } - - - @RequestMapping(value = DUBBO_SERVICES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public Map<String, Map<String, Object>> services() { - - Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap(); - - Map<String, Map<String, Object>> servicesMetadata = new LinkedHashMap<>(serviceBeansMap.size()); - - for (Map.Entry<String, ServiceBean> entry : serviceBeansMap.entrySet()) { - - String serviceBeanName = entry.getKey(); - - ServiceBean serviceBean = entry.getValue(); - - Map<String, Object> serviceBeanMetadata = resolveBeanMetadata(serviceBean); - - Object service = resolveServiceBean(serviceBeanName, serviceBean); - - if (service != null) { - // Add Service implementation class - serviceBeanMetadata.put("serviceClass", service.getClass().getName()); - } - - servicesMetadata.put(serviceBeanName, serviceBeanMetadata); - - } - - return servicesMetadata; - - } - - @RequestMapping(value = DUBBO_REFERENCES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public Map<String, Map<String, Object>> references() { - - Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>(); - - Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap - = resolveInjectedElementReferenceBeanMap(); - - for (Map.Entry<InjectionMetadata.InjectedElement, ReferenceBean<?>> entry : - injectedElementReferenceBeanMap.entrySet()) { - - InjectionMetadata.InjectedElement injectedElement = entry.getKey(); - - ReferenceBean<?> referenceBean = entry.getValue(); - - Map<String, Object> beanMetadata = resolveBeanMetadata(referenceBean); - beanMetadata.put("invoker", resolveBeanMetadata(referenceBean.get())); - - referencesMetadata.put(String.valueOf(injectedElement.getMember()), beanMetadata); - - } - - return referencesMetadata; - - } - - @RequestMapping(value = DUBBO_PROPERTIES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - @ResponseBody - public SortedMap<String, Object> properties() { - - return filterDubboProperties(environment); - - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } - - @Override - public void setEnvironment(Environment environment) { - if (environment instanceof ConfigurableEnvironment) { - this.environment = (ConfigurableEnvironment) environment; - } - } - - private Map<String, ServiceBean> getServiceBeansMap() { - return beansOfTypeIncludingAncestors(applicationContext, ServiceBean.class); - } - - - private void addDubboConfigBeans(Class<? extends AbstractConfig> dubboConfigClass, - Map<String, Map<String, Map<String, Object>>> configsMap) { - - Map<String, ? extends AbstractConfig> dubboConfigBeans = beansOfTypeIncludingAncestors(applicationContext, dubboConfigClass); - - String name = dubboConfigClass.getSimpleName(); - - Map<String, Map<String, Object>> beansMetadata = new TreeMap<>(); - - for (Map.Entry<String, ? extends AbstractConfig> entry : dubboConfigBeans.entrySet()) { - - String beanName = entry.getKey(); - AbstractConfig configBean = entry.getValue(); - Map<String, Object> configBeanMeta = resolveBeanMetadata(configBean); - beansMetadata.put(beanName, configBeanMeta); - - } - - configsMap.put(name, beansMetadata); - - } - - private ReferenceAnnotationBeanPostProcessor getReferenceAnnotationBeanPostProcessor() { - return applicationContext.getBean(BEAN_NAME, ReferenceAnnotationBeanPostProcessor.class); - } - - /** - * Resolves the {@link Collection} of {@link InjectionMetadata.InjectedElement} that were annotated by {@link Reference} - * from all Spring Beans. - * - * @return non-null {@link Collection} - * TODO Reactors ReferenceAnnotationBeanPostProcessor to expose those info - */ - private Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> resolveInjectedElementReferenceBeanMap() { - - Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap = new LinkedHashMap<>(); - - final ReferenceAnnotationBeanPostProcessor processor = getReferenceAnnotationBeanPostProcessor(); - - ConcurrentMap<String, InjectionMetadata> injectionMetadataCache = - getFieldValue(processor, "injectionMetadataCache", ConcurrentMap.class); - - ConcurrentMap<String, ReferenceBean<?>> referenceBeansCache = - getFieldValue(processor, "referenceBeansCache", ConcurrentMap.class); - - for (InjectionMetadata metadata : injectionMetadataCache.values()) { - - Set<InjectionMetadata.InjectedElement> checkedElements = - getFieldValue(metadata, "checkedElements", Set.class); - - Collection<InjectionMetadata.InjectedElement> injectedElements = - getFieldValue(metadata, "injectedElements", Collection.class); - - Collection<InjectionMetadata.InjectedElement> actualInjectedElements = - checkedElements != null ? checkedElements : injectedElements; - - for (InjectionMetadata.InjectedElement injectedElement : actualInjectedElements) { - - ReferenceBean<?> referenceBean = resolveReferenceBean(injectedElement, referenceBeansCache); - - injectedElementReferenceBeanMap.put(injectedElement, referenceBean); - - } - } - - return injectedElementReferenceBeanMap; - - } - - private ReferenceBean<?> resolveReferenceBean(InjectionMetadata.InjectedElement injectedElement, - ConcurrentMap<String, ReferenceBean<?>> referenceBeansCache) { - - // Member is Field or Method annotated @Reference - Member member = injectedElement.getMember(); - - Class<?> beanClass = null; - - Reference reference = getFieldValue(injectedElement, "reference", Reference.class); - - if (member instanceof Field) { - - Field field = (Field) member; - - beanClass = field.getType(); - - } else if (member instanceof Method) { - - Method method = (Method) member; - - beanClass = ((Method) member).getReturnType(); - - } else { - - if (logger.isWarnEnabled()) { - logger.warn("What's wrong with Member? Member should not be Field or Method"); - } - - throw new IllegalStateException("What's wrong with Member? Member should not be Field or Method"); - - } - - String referenceBeanCacheKey = generateReferenceBeanCacheKey(reference, beanClass); - - return referenceBeansCache.get(referenceBeanCacheKey); - - } - - - /** - * Original implementation : - * - * @see ReferenceAnnotationBeanPostProcessor#generateReferenceBeanCacheKey(Reference, java.lang.Class) - */ - private static String generateReferenceBeanCacheKey(Reference reference, Class<?> beanClass) { - - String interfaceName = resolveInterfaceName(reference, beanClass); - - String key = reference.group() + "/" + interfaceName + ":" + reference.version(); - - return key; - - } - - /** - * Original implementation: - * - * @see ReferenceAnnotationBeanPostProcessor#resolveInterfaceName(Reference, java.lang.Class) - */ - private static String resolveInterfaceName(Reference reference, Class<?> beanClass) - throws IllegalStateException { - - String interfaceName; - if (!"".equals(reference.interfaceName())) { - interfaceName = reference.interfaceName(); - } else if (!void.class.equals(reference.interfaceClass())) { - interfaceName = reference.interfaceClass().getName(); - } else if (beanClass.isInterface()) { - interfaceName = beanClass.getName(); - } else { - throw new IllegalStateException( - "The @Reference undefined interfaceClass or interfaceName, and the property type " - + beanClass.getName() + " is not a interface."); - } - - return interfaceName; - - } - - - private <T> T getFieldValue(Object object, String fieldName, Class<T> fieldType) { - - Field field = ReflectionUtils.findField(object.getClass(), fieldName, fieldType); - - ReflectionUtils.makeAccessible(field); - - return (T) ReflectionUtils.getField(field, object); - - } - - private Map<String, Object> resolveBeanMetadata(final Object bean) { - - final Map<String, Object> beanMetadata = new LinkedHashMap<>(); - - try { - - BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - - for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { - - Method readMethod = propertyDescriptor.getReadMethod(); - - if (readMethod != null && isSimpleType(propertyDescriptor.getPropertyType())) { - - String name = Introspector.decapitalize(propertyDescriptor.getName()); - Object value = readMethod.invoke(bean); - - beanMetadata.put(name, value); - } - - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - - return beanMetadata; - - } - - private Object resolveServiceBean(String serviceBeanName, ServiceBean serviceBean) { - - int index = serviceBeanName.indexOf("#"); - - if (index > -1) { - - Class<?> interfaceClass = serviceBean.getInterfaceClass(); - - String serviceName = serviceBeanName.substring(index + 1); - - if (applicationContext.containsBean(serviceName)) { - return applicationContext.getBean(serviceName, interfaceClass); - } - - } - - return null; - - } - - - private static boolean isSimpleType(Class<?> type) { - return isPrimitiveOrWrapper(type) - || type == String.class - || type == BigDecimal.class - || type == BigInteger.class - || type == Date.class - || type == URL.class - || type == Class.class - ; - } - - - private Map<String, ProtocolConfig> getProtocolConfigsBeanMap() { - return beansOfTypeIncludingAncestors(applicationContext, ProtocolConfig.class); - } - - -} diff --git a/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-web-endpoins-default.properties b/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-web-endpoins-default.properties new file mode 100644 index 0000000..af4fd40 --- /dev/null +++ b/dubbo-spring-boot-actuator/src/main/resources/META-INF/dubbo-web-endpoins-default.properties @@ -0,0 +1,22 @@ +# Dubbo Web Endpoints Default Properties is loaded by @PropertySource with low order, +# those values of properties can be override by higher PropertySource +# @see DubboEndpointsAutoConfiguration + +# "management.endpoints.web.base-path" should not be configured in this file + +# Set enabled for Dubbo Web Endpoints +management.endpoint.dubbo.enabled = true +management.endpoint.dubbo-shutdown.enabled = false +management.endpoint.dubbo-configs.enabled = true +management.endpoint.dubbo-services.enabled = false +management.endpoint.dubbo-references.enabled = false +management.endpoint.dubbo-properties.enabled = true + +# Re-defines path-mapping of Dubbo Web Endpoints +management.endpoints.web.path-mapping.dubbo-shutdown = dubbo/shutdown +management.endpoints.web.path-mapping.dubbo-configs = dubbo/configs +management.endpoints.web.path-mapping.dubbo-services = dubbo/services +management.endpoints.web.path-mapping.dubbo-references = dubbo/references +management.endpoints.web.path-mapping.dubbo-properties = dubbo/properties + + diff --git a/dubbo-spring-boot-actuator/src/main/resources/META-INF/spring.factories b/dubbo-spring-boot-actuator/src/main/resources/META-INF/spring.factories index 0833500..ad900ad 100644 --- a/dubbo-spring-boot-actuator/src/main/resources/META-INF/spring.factories +++ b/dubbo-spring-boot-actuator/src/main/resources/META-INF/spring.factories @@ -1,6 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointAutoConfiguration,\ -com.alibaba.boot.dubbo.actuate.autoconfigure.DubboHealthIndicatorAutoConfiguration - -org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration=\ -com.alibaba.boot.dubbo.actuate.autoconfigure.DubboMvcEndpointManagementContextConfiguration \ No newline at end of file +com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointsAutoConfiguration,\ +com.alibaba.boot.dubbo.actuate.autoconfigure.DubboHealthIndicatorAutoConfiguration \ No newline at end of file diff --git a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointTest.java b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointTest.java index a3161be..998f5d0 100644 --- a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointTest.java +++ b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointTest.java @@ -48,15 +48,6 @@ public class DubboEndpointTest { private DubboEndpoint dubboEndpoint; @Test - public void testDefaultValue() { - - Assert.assertTrue(dubboEndpoint.isSensitive()); - Assert.assertFalse(dubboEndpoint.isEnabled()); - Assert.assertEquals("dubbo", dubboEndpoint.getId()); - - } - - @Test public void testInvoke() { Map<String, Object> metadata = dubboEndpoint.invoke(); diff --git a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointsAutoConfigurationTest.java similarity index 78% copy from dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java copy to dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointsAutoConfigurationTest.java index ae5d388..65e60e3 100644 --- a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java +++ b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/DubboEndpointsAutoConfigurationTest.java @@ -14,33 +14,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.boot.dubbo.actuate.endpoint.mvc; +package com.alibaba.boot.dubbo.actuate.endpoint; -import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; -import com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration; +import com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointsAutoConfiguration; import com.alibaba.dubbo.config.annotation.Service; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Bean; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.context.request.async.DeferredResult; +import org.springframework.test.context.junit4.SpringRunner; import java.util.Map; import java.util.SortedMap; /** - * {@link DubboMvcEndpoint} Test + * {@link DubboEndpointsAutoConfiguration} Test * * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> - * @see DubboMvcEndpoint - * @since 1.0.0 + * @since 0.2.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource( +@RunWith(SpringRunner.class) +@SpringBootTest( + classes = { + DubboEndpointsAutoConfiguration.class, + DubboEndpointsAutoConfigurationTest.class, + DubboEndpointsAutoConfigurationTest.DefaultDemoService.class + }, + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { "dubbo.application.id = my-application", "dubbo.application.name = dubbo-demo-application", @@ -54,32 +56,33 @@ import java.util.SortedMap; "dubbo.provider.id=my-provider", "dubbo.provider.host=127.0.0.1", "dubbo.scan.basePackages=com.alibaba.boot.dubbo.actuate.endpoint.mvc" - } -) -@SpringBootTest( - classes = { - DubboAutoConfiguration.class, - DubboEndpoint.class, - DubboMvcEndpointTest.class - } -) -public class DubboMvcEndpointTest { + }) +@EnableAutoConfiguration +public class DubboEndpointsAutoConfigurationTest { - @Bean - public DubboMvcEndpoint dubboMvcEndpoint(DubboEndpoint dubboEndpoint) { - return new DubboMvcEndpoint(dubboEndpoint); - } + @Autowired + private DubboEndpoint dubboEndpoint; + + @Autowired + private DubboConfigsMetadataEndpoint dubboConfigsMetadataEndpoint; @Autowired - private DubboMvcEndpoint dubboMvcEndpoint; + private DubboPropertiesEndpoint dubboPropertiesEndpoint; + + @Autowired + private DubboReferencesMetadataEndpoint dubboReferencesMetadataEndpoint; + + @Autowired + private DubboServicesMetadataEndpoint dubboServicesMetadataEndpoint; + + @Autowired + private DubboShutdownEndpoint dubboShutdownEndpoint; @Test public void testShutdown() throws Exception { - DeferredResult result = dubboMvcEndpoint.shutdown(); - - Map<String, Object> value = (Map<String, Object>) result.getResult(); + Map<String, Object> value = dubboShutdownEndpoint.shutdown(); Map<String, Object> shutdownCounts = (Map<String, Object>) value.get("shutdown.count"); @@ -93,7 +96,7 @@ public class DubboMvcEndpointTest { @Test public void testConfigs() { - Map<String, Map<String, Map<String, Object>>> configsMap = dubboMvcEndpoint.configs(); + Map<String, Map<String, Map<String, Object>>> configsMap = dubboConfigsMetadataEndpoint.configs(); Map<String, Map<String, Object>> beansMetadata = configsMap.get("ApplicationConfig"); Assert.assertEquals("dubbo-demo-application", beansMetadata.get("my-application").get("name")); @@ -130,7 +133,7 @@ public class DubboMvcEndpointTest { @Test public void testServices() { - Map<String, Map<String, Object>> services = dubboMvcEndpoint.services(); + Map<String, Map<String, Object>> services = dubboServicesMetadataEndpoint.services(); Assert.assertEquals(1, services.size()); @@ -143,7 +146,7 @@ public class DubboMvcEndpointTest { @Test public void testReferences() { - Map<String, Map<String, Object>> references = dubboMvcEndpoint.references(); + Map<String, Map<String, Object>> references = dubboReferencesMetadataEndpoint.references(); Assert.assertTrue(references.isEmpty()); @@ -152,7 +155,7 @@ public class DubboMvcEndpointTest { @Test public void testProperties() { - SortedMap<String, Object> properties = dubboMvcEndpoint.properties(); + SortedMap<String, Object> properties = dubboPropertiesEndpoint.properties(); Assert.assertEquals("my-application", properties.get("dubbo.application.id")); Assert.assertEquals("dubbo-demo-application", properties.get("dubbo.application.name")); @@ -187,4 +190,5 @@ public class DubboMvcEndpointTest { String sayHello(String name); } + } diff --git a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java index ae5d388..dadd5a3 100644 --- a/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java +++ b/dubbo-spring-boot-actuator/src/test/java/com/alibaba/boot/dubbo/actuate/endpoint/mvc/DubboMvcEndpointTest.java @@ -1,190 +1,190 @@ -/* - * 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 com.alibaba.boot.dubbo.actuate.endpoint.mvc; - -import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; -import com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration; -import com.alibaba.dubbo.config.annotation.Service; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Bean; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.context.request.async.DeferredResult; - -import java.util.Map; -import java.util.SortedMap; - -/** - * {@link DubboMvcEndpoint} Test - * - * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> - * @see DubboMvcEndpoint - * @since 1.0.0 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource( - properties = { - "dubbo.application.id = my-application", - "dubbo.application.name = dubbo-demo-application", - "dubbo.module.id = my-module", - "dubbo.module.name = dubbo-demo-module", - "dubbo.registry.id = my-registry", - "dubbo.registry.address = N/A", - "dubbo.protocol.id=my-protocol", - "dubbo.protocol.name=dubbo", - "dubbo.protocol.port=20880", - "dubbo.provider.id=my-provider", - "dubbo.provider.host=127.0.0.1", - "dubbo.scan.basePackages=com.alibaba.boot.dubbo.actuate.endpoint.mvc" - } -) -@SpringBootTest( - classes = { - DubboAutoConfiguration.class, - DubboEndpoint.class, - DubboMvcEndpointTest.class - } -) -public class DubboMvcEndpointTest { - - @Bean - public DubboMvcEndpoint dubboMvcEndpoint(DubboEndpoint dubboEndpoint) { - return new DubboMvcEndpoint(dubboEndpoint); - } - - @Autowired - private DubboMvcEndpoint dubboMvcEndpoint; - - - @Test - public void testShutdown() throws Exception { - - DeferredResult result = dubboMvcEndpoint.shutdown(); - - Map<String, Object> value = (Map<String, Object>) result.getResult(); - - Map<String, Object> shutdownCounts = (Map<String, Object>) value.get("shutdown.count"); - - Assert.assertEquals(0, shutdownCounts.get("registries")); - Assert.assertEquals(1, shutdownCounts.get("protocols")); - Assert.assertEquals(1, shutdownCounts.get("services")); - Assert.assertEquals(0, shutdownCounts.get("references")); - - } - - @Test - public void testConfigs() { - - Map<String, Map<String, Map<String, Object>>> configsMap = dubboMvcEndpoint.configs(); - - Map<String, Map<String, Object>> beansMetadata = configsMap.get("ApplicationConfig"); - Assert.assertEquals("dubbo-demo-application", beansMetadata.get("my-application").get("name")); - - beansMetadata = configsMap.get("ConsumerConfig"); - Assert.assertTrue(beansMetadata.isEmpty()); - - beansMetadata = configsMap.get("MethodConfig"); - Assert.assertTrue(beansMetadata.isEmpty()); - - beansMetadata = configsMap.get("ModuleConfig"); - Assert.assertEquals("dubbo-demo-module", beansMetadata.get("my-module").get("name")); - - beansMetadata = configsMap.get("MonitorConfig"); - Assert.assertTrue(beansMetadata.isEmpty()); - - beansMetadata = configsMap.get("ProtocolConfig"); - Assert.assertEquals("dubbo", beansMetadata.get("my-protocol").get("name")); - - beansMetadata = configsMap.get("ProviderConfig"); - Assert.assertEquals("127.0.0.1", beansMetadata.get("my-provider").get("host")); - - beansMetadata = configsMap.get("ReferenceConfig"); - Assert.assertTrue(beansMetadata.isEmpty()); - - beansMetadata = configsMap.get("RegistryConfig"); - Assert.assertEquals("N/A", beansMetadata.get("my-registry").get("address")); - - beansMetadata = configsMap.get("ServiceConfig"); - Assert.assertFalse(beansMetadata.isEmpty()); - - } - - @Test - public void testServices() { - - Map<String, Map<String, Object>> services = dubboMvcEndpoint.services(); - - Assert.assertEquals(1, services.size()); - - Map<String, Object> demoServiceMeta = services.get("serviceb...@com.alibaba.boot.dubbo.actuate.endpoint.mvc.DubboMvcEndpointTest$DemoService#dubboMvcEndpointTest.DefaultDemoService"); - - Assert.assertEquals("1.0.0", demoServiceMeta.get("version")); - - } - - @Test - public void testReferences() { - - Map<String, Map<String, Object>> references = dubboMvcEndpoint.references(); - - Assert.assertTrue(references.isEmpty()); - - } - - @Test - public void testProperties() { - - SortedMap<String, Object> properties = dubboMvcEndpoint.properties(); - - Assert.assertEquals("my-application", properties.get("dubbo.application.id")); - Assert.assertEquals("dubbo-demo-application", properties.get("dubbo.application.name")); - Assert.assertEquals("my-module", properties.get("dubbo.module.id")); - Assert.assertEquals("dubbo-demo-module", properties.get("dubbo.module.name")); - Assert.assertEquals("my-registry", properties.get("dubbo.registry.id")); - Assert.assertEquals("N/A", properties.get("dubbo.registry.address")); - Assert.assertEquals("my-protocol", properties.get("dubbo.protocol.id")); - Assert.assertEquals("dubbo", properties.get("dubbo.protocol.name")); - Assert.assertEquals("20880", properties.get("dubbo.protocol.port")); - Assert.assertEquals("my-provider", properties.get("dubbo.provider.id")); - Assert.assertEquals("127.0.0.1", properties.get("dubbo.provider.host")); - Assert.assertEquals("com.alibaba.boot.dubbo.actuate.endpoint.mvc", properties.get("dubbo.scan.basePackages")); - } - - - @Service( - version = "1.0.0", - application = "${dubbo.application.id}", - protocol = "${dubbo.protocol.id}", - registry = "${dubbo.registry.id}" - ) - static class DefaultDemoService implements DemoService { - - public String sayHello(String name) { - return "Hello, " + name + " (from Spring Boot)"; - } - - } - - interface DemoService { - String sayHello(String name); - } - -} +///* +// * 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 com.alibaba.boot.dubbo.actuate.endpoint.mvc; +// +//import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; +//import com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration; +//import com.alibaba.dubbo.config.annotation.Service; +//import org.junit.Assert; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.context.annotation.Bean; +//import org.springframework.test.context.TestPropertySource; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +//import org.springframework.web.context.request.async.DeferredResult; +// +//import java.util.Map; +//import java.util.SortedMap; +// +///** +// * {@link DubboMvcEndpoint} Test +// * +// * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> +// * @see DubboMvcEndpoint +// * @since 1.0.0 +// */ +//@RunWith(SpringJUnit4ClassRunner.class) +//@TestPropertySource( +// properties = { +// "dubbo.application.id = my-application", +// "dubbo.application.name = dubbo-demo-application", +// "dubbo.module.id = my-module", +// "dubbo.module.name = dubbo-demo-module", +// "dubbo.registry.id = my-registry", +// "dubbo.registry.address = N/A", +// "dubbo.protocol.id=my-protocol", +// "dubbo.protocol.name=dubbo", +// "dubbo.protocol.port=20880", +// "dubbo.provider.id=my-provider", +// "dubbo.provider.host=127.0.0.1", +// "dubbo.scan.basePackages=com.alibaba.boot.dubbo.actuate.endpoint.mvc" +// } +//) +//@SpringBootTest( +// classes = { +// DubboAutoConfiguration.class, +// DubboEndpoint.class, +// DubboMvcEndpointTest.class +// } +//) +//public class DubboMvcEndpointTest { +// +// @Bean +// public DubboMvcEndpoint dubboMvcEndpoint(DubboEndpoint dubboEndpoint) { +// return new DubboMvcEndpoint(dubboEndpoint); +// } +// +// @Autowired +// private DubboMvcEndpoint dubboMvcEndpoint; +// +// +// @Test +// public void testShutdown() throws Exception { +// +// DeferredResult result = dubboMvcEndpoint.shutdown(); +// +// Map<String, Object> value = (Map<String, Object>) result.getResult(); +// +// Map<String, Object> shutdownCounts = (Map<String, Object>) value.get("shutdown.count"); +// +// Assert.assertEquals(0, shutdownCounts.get("registries")); +// Assert.assertEquals(1, shutdownCounts.get("protocols")); +// Assert.assertEquals(1, shutdownCounts.get("services")); +// Assert.assertEquals(0, shutdownCounts.get("references")); +// +// } +// +// @Test +// public void testConfigs() { +// +// Map<String, Map<String, Map<String, Object>>> configsMap = dubboMvcEndpoint.configs(); +// +// Map<String, Map<String, Object>> beansMetadata = configsMap.get("ApplicationConfig"); +// Assert.assertEquals("dubbo-demo-application", beansMetadata.get("my-application").get("name")); +// +// beansMetadata = configsMap.get("ConsumerConfig"); +// Assert.assertTrue(beansMetadata.isEmpty()); +// +// beansMetadata = configsMap.get("MethodConfig"); +// Assert.assertTrue(beansMetadata.isEmpty()); +// +// beansMetadata = configsMap.get("ModuleConfig"); +// Assert.assertEquals("dubbo-demo-module", beansMetadata.get("my-module").get("name")); +// +// beansMetadata = configsMap.get("MonitorConfig"); +// Assert.assertTrue(beansMetadata.isEmpty()); +// +// beansMetadata = configsMap.get("ProtocolConfig"); +// Assert.assertEquals("dubbo", beansMetadata.get("my-protocol").get("name")); +// +// beansMetadata = configsMap.get("ProviderConfig"); +// Assert.assertEquals("127.0.0.1", beansMetadata.get("my-provider").get("host")); +// +// beansMetadata = configsMap.get("ReferenceConfig"); +// Assert.assertTrue(beansMetadata.isEmpty()); +// +// beansMetadata = configsMap.get("RegistryConfig"); +// Assert.assertEquals("N/A", beansMetadata.get("my-registry").get("address")); +// +// beansMetadata = configsMap.get("ServiceConfig"); +// Assert.assertFalse(beansMetadata.isEmpty()); +// +// } +// +// @Test +// public void testServices() { +// +// Map<String, Map<String, Object>> services = dubboMvcEndpoint.services(); +// +// Assert.assertEquals(1, services.size()); +// +// Map<String, Object> demoServiceMeta = services.get("serviceb...@com.alibaba.boot.dubbo.actuate.endpoint.mvc.DubboMvcEndpointTest$DemoService#dubboMvcEndpointTest.DefaultDemoService"); +// +// Assert.assertEquals("1.0.0", demoServiceMeta.get("version")); +// +// } +// +// @Test +// public void testReferences() { +// +// Map<String, Map<String, Object>> references = dubboMvcEndpoint.references(); +// +// Assert.assertTrue(references.isEmpty()); +// +// } +// +// @Test +// public void testProperties() { +// +// SortedMap<String, Object> properties = dubboMvcEndpoint.properties(); +// +// Assert.assertEquals("my-application", properties.get("dubbo.application.id")); +// Assert.assertEquals("dubbo-demo-application", properties.get("dubbo.application.name")); +// Assert.assertEquals("my-module", properties.get("dubbo.module.id")); +// Assert.assertEquals("dubbo-demo-module", properties.get("dubbo.module.name")); +// Assert.assertEquals("my-registry", properties.get("dubbo.registry.id")); +// Assert.assertEquals("N/A", properties.get("dubbo.registry.address")); +// Assert.assertEquals("my-protocol", properties.get("dubbo.protocol.id")); +// Assert.assertEquals("dubbo", properties.get("dubbo.protocol.name")); +// Assert.assertEquals("20880", properties.get("dubbo.protocol.port")); +// Assert.assertEquals("my-provider", properties.get("dubbo.provider.id")); +// Assert.assertEquals("127.0.0.1", properties.get("dubbo.provider.host")); +// Assert.assertEquals("com.alibaba.boot.dubbo.actuate.endpoint.mvc", properties.get("dubbo.scan.basePackages")); +// } +// +// +// @Service( +// version = "1.0.0", +// application = "${dubbo.application.id}", +// protocol = "${dubbo.protocol.id}", +// registry = "${dubbo.registry.id}" +// ) +// static class DefaultDemoService implements DemoService { +// +// public String sayHello(String name) { +// return "Hello, " + name + " (from Spring Boot)"; +// } +// +// } +// +// interface DemoService { +// String sayHello(String name); +// } +// +//} diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java index 25bc963..2f4bc4f 100644 --- a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java +++ b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/DubboAutoConfiguration.java @@ -29,8 +29,8 @@ import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfig; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.bind.RelaxedDataBinder; -import org.springframework.boot.bind.RelaxedPropertyResolver; +import org.springframework.boot.context.properties.bind.Binder; +import org.springframework.boot.context.properties.source.ConfigurationPropertySources; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @@ -87,15 +87,14 @@ public class DubboAutoConfiguration { * @return {@link ServiceAnnotationBeanPostProcessor} */ @ConditionalOnProperty(name = BASE_PACKAGES_PROPERTY_NAME) - @ConditionalOnClass(RelaxedPropertyResolver.class) + @ConditionalOnClass(ConfigurationPropertySources.class) @Bean public ServiceAnnotationBeanPostProcessor serviceAnnotationBeanPostProcessor(Environment environment) { - RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment); - Set<String> packagesToScan = resolver.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet()); + Set<String> packagesToScan = environment.getProperty(BASE_PACKAGES_PROPERTY_NAME, Set.class, emptySet()); return new ServiceAnnotationBeanPostProcessor(packagesToScan); } - @ConditionalOnClass(RelaxedDataBinder.class) + @ConditionalOnClass(Binder.class) @Bean @Scope(scopeName = SCOPE_PROTOTYPE) public RelaxedDubboConfigBinder relaxedDubboConfigBinder() { diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java index e9c9707..1bbd18a 100644 --- a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java +++ b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/autoconfigure/RelaxedDubboConfigBinder.java @@ -19,32 +19,54 @@ package com.alibaba.boot.dubbo.autoconfigure; import com.alibaba.dubbo.config.AbstractConfig; import com.alibaba.dubbo.config.spring.context.properties.AbstractDubboConfigBinder; import com.alibaba.dubbo.config.spring.context.properties.DubboConfigBinder; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.boot.bind.RelaxedDataBinder; +import org.springframework.boot.context.properties.bind.BindHandler; +import org.springframework.boot.context.properties.bind.Bindable; +import org.springframework.boot.context.properties.bind.Binder; +import org.springframework.boot.context.properties.bind.handler.IgnoreErrorsBindHandler; +import org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler; +import org.springframework.boot.context.properties.source.ConfigurationPropertySource; +import org.springframework.boot.context.properties.source.UnboundElementsSourceFilter; -import java.util.Map; - -import static com.alibaba.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties; +import static org.springframework.boot.context.properties.source.ConfigurationPropertySources.from; /** * Spring Boot Relaxed {@link DubboConfigBinder} implementation * * @author <a href="mailto:mercybl...@gmail.com">Mercy</a> + * @revision 0.2.0 + * @see org.springframework.boot.context.properties.ConfigurationPropertiesBinder * @since 0.1.1 */ public class RelaxedDubboConfigBinder extends AbstractDubboConfigBinder { @Override public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) { - RelaxedDataBinder relaxedDataBinder = new RelaxedDataBinder(dubboConfig); - // Set ignored* - relaxedDataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields()); - relaxedDataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields()); - // Get properties under specified prefix from PropertySources - Map<String, String> properties = getSubProperties(getPropertySources(), prefix); - // Convert Map to MutablePropertyValues - MutablePropertyValues propertyValues = new MutablePropertyValues(properties); + + // Converts ConfigurationPropertySources + Iterable<ConfigurationPropertySource> propertySources = from(getPropertySources()); + + // Wrap Bindable from DubboConfig instance + Bindable<C> bindable = Bindable.ofInstance(dubboConfig); + + Binder binder = new Binder(propertySources); + + // Get BindHandler + BindHandler bindHandler = getBindHandler(); + // Bind - relaxedDataBinder.bind(propertyValues); + binder.bind(prefix, bindable, bindHandler); + + } + + private BindHandler getBindHandler() { + BindHandler handler = BindHandler.DEFAULT; + if (isIgnoreInvalidFields()) { + handler = new IgnoreErrorsBindHandler(handler); + } + if (!isIgnoreUnknownFields()) { + UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter(); + handler = new NoUnboundElementsBindHandler(handler, filter); + } + return handler; } } diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/AwaitingNonWebApplicationListener.java b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/AwaitingNonWebApplicationListener.java index a2b8b3f..55c3daa 100644 --- a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/AwaitingNonWebApplicationListener.java +++ b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/AwaitingNonWebApplicationListener.java @@ -19,6 +19,7 @@ package com.alibaba.boot.dubbo.context.event; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; @@ -47,7 +48,7 @@ public class AwaitingNonWebApplicationListener implements ApplicationListener<Ap final SpringApplication springApplication = event.getSpringApplication(); - if (springApplication.isWebEnvironment()) { + if (!WebApplicationType.NONE.equals(springApplication.getWebApplicationType())) { return; } diff --git a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/WelcomeLogoApplicationListener.java b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/WelcomeLogoApplicationListener.java index 4e0c134..33c2641 100644 --- a/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/WelcomeLogoApplicationListener.java +++ b/dubbo-spring-boot-autoconfigure/src/main/java/com/alibaba/boot/dubbo/context/event/WelcomeLogoApplicationListener.java @@ -20,7 +20,7 @@ import com.alibaba.dubbo.common.Version; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; -import org.springframework.boot.logging.LoggingApplicationListener; +import org.springframework.boot.context.logging.LoggingApplicationListener; import org.springframework.context.ApplicationListener; import org.springframework.core.annotation.Order; diff --git a/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json b/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json new file mode 100644 index 0000000..8b6b282 --- /dev/null +++ b/dubbo-spring-boot-autoconfigure/src/main/resources/META-INF/spring-configuration-metadata.json @@ -0,0 +1,1098 @@ +{ + "hints": [], + "groups": [], + "properties": [ + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.architecture", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.compiler", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.dump-directory", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.environment", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.logger", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.monitor", + "type": "com.alibaba.dubbo.config.MonitorConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.name", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.organization", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.owner", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.qos-accept-foreign-ip", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.qos-enable", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.qos-port", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.registries", + "type": "java.util.List<com.alibaba.dubbo.config.RegistryConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.registry", + "type": "com.alibaba.dubbo.config.RegistryConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ApplicationConfig", + "name": "dubbo.application.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.applications", + "description": "Multiple {@link ApplicationConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.ApplicationConfig>" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.DubboConfigProperties", + "name": "dubbo.config.multiple", + "description": "Indicates multiple properties binding from externalized configuration or not.", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.boot.dubbo.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": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.actives", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.application", + "type": "com.alibaba.dubbo.config.ApplicationConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.async", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.cache", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.callbacks", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.check", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.client", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.cluster", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.connections", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.filter", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.generic", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.group", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.init", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "deprecated": true, + "name": "dubbo.consumer.injvm", + "type": "java.lang.Boolean", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.layer", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.lazy", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.listener", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.loadbalance", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "deprecated": true, + "name": "dubbo.consumer.local", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.merger", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.mock", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.module", + "type": "com.alibaba.dubbo.config.ModuleConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.monitor", + "type": "com.alibaba.dubbo.config.MonitorConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.onconnect", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.ondisconnect", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.owner", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.proxy", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.reconnect", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.registries", + "type": "java.util.List<com.alibaba.dubbo.config.RegistryConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.registry", + "type": "com.alibaba.dubbo.config.RegistryConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.retries", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.scope", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.sent", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.sticky", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.stub", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.timeout", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.validation", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ConsumerConfig", + "name": "dubbo.consumer.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.consumers", + "description": "Multiple {@link ConsumerConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.ConsumerConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.monitor", + "type": "com.alibaba.dubbo.config.MonitorConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.name", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.organization", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.owner", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.registries", + "type": "java.util.List<com.alibaba.dubbo.config.RegistryConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.registry", + "type": "com.alibaba.dubbo.config.RegistryConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ModuleConfig", + "name": "dubbo.module.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.modules", + "description": "Multiple {@link ModuleConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.ModuleConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.address", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.group", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.password", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.protocol", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.username", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.MonitorConfig", + "name": "dubbo.monitor.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.monitors", + "description": "Multiple {@link MonitorConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.MonitorConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.accepts", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.accesslog", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.buffer", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.charset", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.client", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.codec", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.contextpath", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.dispatcher", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "deprecated": true, + "name": "dubbo.protocol.dispather", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.exchanger", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.heartbeat", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.host", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.iothreads", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.name", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.networker", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "deprecated": true, + "name": "dubbo.protocol.path", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.payload", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.port", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.prompt", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.queues", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.register", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.serialization", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.server", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.status", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.telnet", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.threadpool", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.threads", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProtocolConfig", + "name": "dubbo.protocol.transporter", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.protocols", + "description": "Multiple {@link ProtocolConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.ProtocolConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.accepts", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.accesslog", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.actives", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.application", + "type": "com.alibaba.dubbo.config.ApplicationConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.async", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.buffer", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.cache", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.callbacks", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.charset", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.client", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.cluster", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.codec", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.connections", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.contextpath", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "deprecated": true, + "name": "dubbo.provider.default", + "type": "java.lang.Boolean", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.delay", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.deprecated", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.dispatcher", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "deprecated": true, + "name": "dubbo.provider.dispather", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.document", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.dynamic", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.exchanger", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.executes", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.export", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.filter", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.group", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.host", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.iothreads", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.layer", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.listener", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.loadbalance", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "deprecated": true, + "name": "dubbo.provider.local", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.merger", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.mock", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.module", + "type": "com.alibaba.dubbo.config.ModuleConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.monitor", + "type": "com.alibaba.dubbo.config.MonitorConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.networker", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.onconnect", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.ondisconnect", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.owner", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "deprecated": true, + "name": "dubbo.provider.path", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.payload", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "deprecated": true, + "name": "dubbo.provider.port", + "type": "java.lang.Integer", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.prompt", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.protocol", + "type": "com.alibaba.dubbo.config.ProtocolConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.protocols", + "type": "java.util.List<com.alibaba.dubbo.config.ProtocolConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.proxy", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.queues", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.register", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.registries", + "type": "java.util.List<com.alibaba.dubbo.config.RegistryConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.registry", + "type": "com.alibaba.dubbo.config.RegistryConfig" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.retries", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.scope", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.sent", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.serialization", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.server", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.status", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.stub", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.telnet", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.threadpool", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.threads", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.timeout", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.token", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.transporter", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.validation", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.wait", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.warmup", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.ProviderConfig", + "name": "dubbo.provider.weight", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.providers", + "description": "Multiple {@link ProviderConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.ProviderConfig>" + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.MultipleDubboConfigBindingProperties", + "name": "dubbo.registries", + "description": "Multiple {@link RegistryConfig} property", + "type": "java.util.Map<java.lang.String,com.alibaba.dubbo.config.RegistryConfig>" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.address", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.check", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.client", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.cluster", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.default", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.dynamic", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.file", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.group", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.id", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.parameters", + "type": "java.util.Map<java.lang.String,java.lang.String>" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.password", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.port", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.protocol", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.register", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.server", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.session", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.subscribe", + "type": "java.lang.Boolean" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.timeout", + "type": "java.lang.Integer" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "deprecated": true, + "name": "dubbo.registry.transport", + "type": "java.lang.String", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.transporter", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.username", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "name": "dubbo.registry.version", + "type": "java.lang.String" + }, + { + "sourceType": "com.alibaba.dubbo.config.RegistryConfig", + "deprecated": true, + "name": "dubbo.registry.wait", + "type": "java.lang.Integer", + "deprecation": {} + }, + { + "sourceType": "com.alibaba.boot.dubbo.autoconfigure.DubboScanProperties", + "name": "dubbo.scan.base-packages", + "description": "The basePackages to scan , the multiple-value is delimited by comma\n\n @see EnableDubbo#scanBasePackages()", + "type": "java.util.Set<java.lang.String>" + } + ] +} \ No newline at end of file diff --git a/dubbo-spring-boot-parent/pom.xml b/dubbo-spring-boot-parent/pom.xml index 1f80b66..3365979 100644 --- a/dubbo-spring-boot-parent/pom.xml +++ b/dubbo-spring-boot-parent/pom.xml @@ -17,10 +17,10 @@ <description>Dubbo Spring Boot Parent</description> <properties> - <java.version>1.7</java.version> + <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <spring-boot.version>1.5.10.RELEASE</spring-boot.version> + <spring-boot.version>2.0.0.RELEASE</spring-boot.version> <dubbo.version>2.5.11</dubbo.version> <zkclient.version>0.2</zkclient.version> <zookeeper.version>3.4.9</zookeeper.version> diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/pom.xml b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/pom.xml index f764546..73717d4 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/pom.xml @@ -23,7 +23,7 @@ <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-actuator</artifactId> + <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> @@ -33,6 +33,12 @@ </dependency> <dependency> + <groupId>com.alibaba.boot</groupId> + <artifactId>dubbo-spring-boot-actuator</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>${project.groupId}</groupId> <artifactId>dubbo-spring-boot-sample-api</artifactId> <version>${project.version}</version> diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties index 7fc14dd..b794b88 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties @@ -1,8 +1,7 @@ # Spring boot application spring.application.name = dubbo-consumer-demo server.port = 8080 -management.port = 8081 -management.security.enabled = false +management.server.port = 8081 # Dubbo Config properties ## ApplicationConfig Bean @@ -22,4 +21,15 @@ endpoints.dubbo.enabled = true # Dubbo Health ## StatusChecker Name defaults (default : "memory", "load" ) -management.health.dubbo.status.defaults = memory \ No newline at end of file +management.health.dubbo.status.defaults = memory + +# Enables Dubbo All Endpoints +management.endpoint.dubbo.enabled = true +management.endpoint.dubbo-shutdown.enabled = true +management.endpoint.dubbo-configs.enabled = true +management.endpoint.dubbo-services.enabled = true +management.endpoint.dubbo-references.enabled = true +management.endpoint.dubbo-properties.enabled = true + +# Exposes all web endpoints +management.endpoints.web.exposure.include = * \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/pom.xml b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/pom.xml index 0ed1322..8f44c61 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/pom.xml @@ -23,7 +23,7 @@ <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-actuator</artifactId> + <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> @@ -33,6 +33,12 @@ </dependency> <dependency> + <groupId>com.alibaba.boot</groupId> + <artifactId>dubbo-spring-boot-actuator</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>${project.groupId}</groupId> <artifactId>dubbo-spring-boot-sample-api</artifactId> <version>${project.version}</version> diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java index db3fcf1..a252032 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java @@ -17,6 +17,7 @@ package com.alibaba.boot.dubbo.demo.provider.bootstrap; import com.alibaba.boot.dubbo.demo.provider.service.DefaultDemoService; +import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -33,7 +34,7 @@ public class DubboProviderDemo { public static void main(String[] args) { new SpringApplicationBuilder(DubboProviderDemo.class) - .web(false) + .web(WebApplicationType.NONE) .run(args); } diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties index 9583845..179eb87 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties @@ -1,8 +1,6 @@ # Spring boot application spring.application.name = dubbo-provider-demo server.port = 9090 -management.port = 9091 -management.security.enabled = false # Base packages to scan Dubbo Components (e.g @Service , @Reference) dubbo.scan.basePackages = com.alibaba.boot.dubbo.demo.provider.service diff --git a/dubbo-spring-boot-starter/pom.xml b/dubbo-spring-boot-starter/pom.xml index 49691eb..ff8351a 100644 --- a/dubbo-spring-boot-starter/pom.xml +++ b/dubbo-spring-boot-starter/pom.xml @@ -46,10 +46,6 @@ <artifactId>dubbo-spring-boot-autoconfigure</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>com.alibaba.boot</groupId> - <artifactId>dubbo-spring-boot-actuator</artifactId> - <version>${project.version}</version> - </dependency> + </dependencies> </project> \ No newline at end of file -- To stop receiving notification emails like this one, please contact mercybl...@apache.org.