Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.x (#331) #2

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,32 @@

You can introduce the latest `dubbo-spring-boot-starter` to your project by adding the following dependency to your pom.xml
```xml
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.1</version>
</dependency>

<!-- Dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.2</version>
</dependency>
<dependencies>

...

<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.2-SNAPSHOT</version>
</dependency>

<!-- Dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.2</version>
</dependency>

...

</dependencies>
```

If your project failed to resolve the dependency, try to add the following repository:
Expand All @@ -60,15 +68,14 @@ If your project failed to resolve the dependency, try to add the following repos

If you'd like to attempt to experience latest features, you also can build from source as follow:

1. Maven install [dubbo 2.6.2-SNAPSHOT](https://github.com/apache/incubator-dubbo/tree/2.6.2-release) in your local repository
2. Maven install current project in your local repository.
1. Maven install current project in your local repository.
> Maven install = `mvn install`

### Dependencies

| versions | Java | Spring Boot | Dubbo |
| -------- | ----- | ----------- | ---------- |
| `0.1.1` | 1.7+ | `1.5.x` | `2.6.2` + |
| `0.1.x` | 1.7+ | `1.5.x` | `2.6.x` + |


## Getting Started
Expand Down
49 changes: 28 additions & 21 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,32 @@

您可以为您的工程引入最新 `dubbo-spring-boot-starter` 的发布,增加以下依赖到工程的 `pom.xml` 文件中:
```xml
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.1</version>
</dependency>

<!-- Dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.2</version>
</dependency>
<dependencies>

...

<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.2-SNAPSHOT</version>
</dependency>

<!-- Dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.2</version>
</dependency>

...

</dependencies>
```

如果您的工程遇到了依赖问题, 请尝试添加如下 Maven 参考到工程的 `pom.xml` 文件中:
Expand All @@ -61,15 +69,14 @@

如果你需要尝试最新 `dubbo-spring-boot-project` 的特性,您可将当前工程手动 Maven install 到本地 Maven 仓库:

1. Maven install [dubbo 2.6.2-SNAPSHOT](https://github.com/apache/incubator-dubbo/tree/2.6.2-release)
2. Maven install 当前工程
1. Maven install 当前工程
> Maven install = `mvn install`

### 依赖关系

| 版本 | Java | Spring Boot | Dubbo |
| -------- | ----- | ----------------- | ---------- |
| `0.1.1` | 1.7+ | `1.5.x` | `2.6.2`+ |
| `0.1.x` | 1.7+ | `1.5.x` | `2.6.x`+ |



Expand Down
2 changes: 1 addition & 1 deletion dubbo-spring-boot-actuator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.2-SNAPSHOT</version>
</dependency>
```
If your project failed to resolve the dependency, try to add the following repository:
Expand Down
4 changes: 2 additions & 2 deletions dubbo-spring-boot-actuator/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>

<!-- Production-Ready 特性 -->
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-actuator</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>

...
Expand Down
4 changes: 2 additions & 2 deletions dubbo-spring-boot-actuator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
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.
-->
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-spring-boot-parent</artifactId>
<groupId>com.alibaba.boot</groupId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
<relativePath>../dubbo-spring-boot-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint;
import com.alibaba.dubbo.config.annotation.Service;

import org.springframework.boot.actuate.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand All @@ -37,6 +39,7 @@ public class DubboEndpointAutoConfiguration {

@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint(value = "dubbo", enabledByDefault = false)
public DubboEndpoint dubboEndpoint() {
return new DubboEndpoint();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,22 @@
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.AbstractConfig;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ConsumerConfig;
import com.alibaba.dubbo.config.MethodConfig;
import com.alibaba.dubbo.config.ModuleConfig;
import com.alibaba.dubbo.config.MonitorConfig;
import com.alibaba.dubbo.config.ProtocolConfig;
import com.alibaba.dubbo.config.ProviderConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.ServiceConfig;
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;
Expand Down Expand Up @@ -49,10 +60,20 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentMap;

import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.*;
import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_CONFIGS_ENDPOINT_URI;
import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_PROPERTIES_ENDPOINT_URI;
import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_REFERENCES_ENDPOINT_URI;
import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_SERVICES_ENDPOINT_URI;
import static com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint.DUBBO_SHUTDOWN_ENDPOINT_URI;
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;
Expand Down Expand Up @@ -182,8 +203,18 @@ public Map<String, Map<String, Object>> references() {

Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>();

Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap
= resolveInjectedElementReferenceBeanMap();
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()) {
Expand All @@ -200,7 +231,6 @@ public Map<String, Map<String, Object>> references() {
}

return referencesMetadata;

}

@RequestMapping(value = DUBBO_PROPERTIES_ENDPOINT_URI, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down Expand Up @@ -271,7 +301,7 @@ private Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> resolveInjected
getFieldValue(processor, "injectionMetadataCache", ConcurrentMap.class);

ConcurrentMap<String, ReferenceBean<?>> referenceBeansCache =
getFieldValue(processor, "referenceBeansCache", ConcurrentMap.class);
getFieldValue(processor, "referenceBeanCache", ConcurrentMap.class);

for (InjectionMetadata metadata : injectionMetadataCache.values()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alibaba.boot.dubbo.actuate.health;

import com.alibaba.dubbo.common.status.StatusChecker;

import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.context.properties.ConfigurationProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion dubbo-spring-boot-autoconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You can introduce the latest `dubbo-spring-boot-autoconfigure` to your project
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-autoconfigure</artifactId>
<version>0.1.1</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>
```

Expand Down
7 changes: 4 additions & 3 deletions dubbo-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
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.
-->
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-parent</artifactId>
<version>0.1.1</version>

<version>0.1.2-SNAPSHOT</version>
<relativePath>../dubbo-spring-boot-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -58,10 +59,10 @@
<optional>true</optional>
</dependency>

<!-- Alibaba Spring Context extension -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.2</version>
</dependency>

<!-- Test Dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.alibaba.dubbo.config.spring.context.annotation.DubboConfigConfiguration;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
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;
Expand All @@ -38,7 +39,9 @@

import java.util.Set;

import static com.alibaba.boot.dubbo.util.DubboUtils.*;
import static com.alibaba.boot.dubbo.util.DubboUtils.BASE_PACKAGES_PROPERTY_NAME;
import static com.alibaba.boot.dubbo.util.DubboUtils.DUBBO_PREFIX;
import static com.alibaba.boot.dubbo.util.DubboUtils.MULTIPLE_CONFIG_PROPERTY_NAME;
import static java.util.Collections.emptySet;
import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;

Expand All @@ -41,7 +42,7 @@ public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) {
relaxedDataBinder.setIgnoreInvalidFields(isIgnoreInvalidFields());
relaxedDataBinder.setIgnoreUnknownFields(isIgnoreUnknownFields());
// Get properties under specified prefix from PropertySources
Map<String, Object> properties = getSubProperties(this.getPropertySources(), prefix);
Map<String, Object> properties = getSubProperties(getPropertySources(), prefix);
// Convert Map to MutablePropertyValues
MutablePropertyValues propertyValues = new MutablePropertyValues(properties);
// Bind
Expand Down
Loading