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.2.1 #357

Merged
merged 27 commits into from
Jan 7, 2019
Merged

0.2.1 #357

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1494a77
Fix apache/incubator-dubbo-spring-boot-project#169
mercyblitz Jun 8, 2018
0efa7c9
Merge remote-tracking branch 'upstream/master'
mercyblitz Jun 8, 2018
531debd
Merge remote-tracking branch 'upstream/master'
mercyblitz Dec 7, 2018
2627f2c
Polish : apache/incubator-dubbo-spring-boot-project#324 & apache/incu…
mercyblitz Dec 12, 2018
cc3c0b5
Polish : apache/incubator-dubbo-spring-boot-project#315
mercyblitz Dec 12, 2018
fea78cd
Polish : apache/incubator-dubbo-spring-boot-project#321
mercyblitz Dec 14, 2018
8bca1c1
Polish : apache/incubator-dubbo-spring-boot-project#321
mercyblitz Dec 14, 2018
a35788f
Polish : apache/incubator-dubbo-spring-boot-project#321 for test case
mercyblitz Dec 14, 2018
60bc540
Polish : Update Demos
mercyblitz Dec 18, 2018
49c1377
Polish : Update version to be 0.2.1
mercyblitz Dec 18, 2018
f55886d
Polish : apache/incubator-dubbo-spring-boot-project#319
mercyblitz Dec 18, 2018
0a44ae0
Polish : apache/incubator-dubbo-spring-boot-project#226
mercyblitz Dec 18, 2018
49b1bbb
Polish : apache/incubator-dubbo-spring-boot-project#309
mercyblitz Dec 18, 2018
eac18ce
Fix the test case's bugs
mercyblitz Dec 18, 2018
50d6c02
Fix the test case's bugs
mercyblitz Dec 18, 2018
717c6b0
Fix a JavaDoc issue
mercyblitz Dec 18, 2018
213bcee
Update SNAPSHOT and add exclude list
mercyblitz Dec 18, 2018
049aaea
Update SNAPSHOT to be 0.2.1-SNAPSHOT
mercyblitz Dec 18, 2018
4b6b610
Update JDK versions
mercyblitz Dec 18, 2018
9cc4533
Update JDK versions
mercyblitz Dec 18, 2018
c668b90
Reactor & remove author info
mercyblitz Dec 19, 2018
71ffe43
Refactor : to save a shutdown hook thread
mercyblitz Dec 27, 2018
9c3015e
Remove javax.servlet:javax.servlet-api:3.1.0 that may cause class con…
mercyblitz Dec 27, 2018
e005f36
Polish apache/incubator-dubbo-spring-boot-project#341
mercyblitz Dec 27, 2018
0191212
Merge branch '0.2.1' into 0.2.1
mercyblitz Dec 27, 2018
fab36c4
Add the samples
mercyblitz Jan 4, 2019
bd4d048
Add a license
mercyblitz Jan 7, 2019
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
12 changes: 6 additions & 6 deletions dubbo-spring-boot-actuator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For now, `dubbo-spring-boot-actuator` will separate two versions for Spring Boot

* `0.1.x` is a legacy version for maintaining Spring Boot 1.x




## Integrate with Maven
Expand Down Expand Up @@ -503,10 +503,10 @@ Dubbo Spring Boot providers actuator endpoints , however some of them are disabl
```properties
# Enables Dubbo All Endpoints
management.endpoint.dubbo.enabled = true
management.endpoint.dubboShutdown.enabled = true
management.endpoint.dubboConfigs.enabled = true
management.endpoint.dubboServices.enabled = true
management.endpoint.dubboReferences.enabled = true
management.endpoint.dubboProperties.enabled = true
management.endpoint.dubboshutdown.enabled = true
management.endpoint.dubboconfigs.enabled = true
management.endpoint.dubboservices.enabled = true
management.endpoint.dubboreferences.enabled = true
management.endpoint.dubboproperties.enabled = true
```

9 changes: 0 additions & 9 deletions dubbo-spring-boot-actuator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@

<dependencies>

<!-- Compile -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*
* @since 0.2.0
*/
@Endpoint(id = "dubboConfigs")
@Endpoint(id = "dubboconfigs")
public class DubboConfigsMetadataEndpoint extends AbstractDubboEndpoint {

@ReadOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @since 1.0.0
*/
@Endpoint(id = "dubboProperties")
@Endpoint(id = "dubboproperties")
public class DubboPropertiesEndpoint extends AbstractDubboEndpoint {

@ReadOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
* @since 1.0.0
*/
@Endpoint(id = "dubboReferences")
@Endpoint(id = "dubboreferences")
public class DubboReferencesMetadataEndpoint extends AbstractDubboEndpoint {

@ReadOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* @since 0.2.0
*/
@Endpoint(id = "dubboServices")
@Endpoint(id = "dubboservices")
public class DubboServicesMetadataEndpoint extends AbstractDubboEndpoint {

@ReadOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
/**
* Dubbo Shutdown
*
*
* @since 0.2.0
*/
@Endpoint(id = "dubboShutdown")
@Endpoint(id = "dubboshutdown")
public class DubboShutdownEndpoint extends AbstractDubboEndpoint {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@

# Set enabled for Dubbo Endpoints
management.endpoint.dubbo.enabled = true
management.endpoint.dubboShutdown.enabled = false
management.endpoint.dubboConfigs.enabled = true
management.endpoint.dubboServices.enabled = false
management.endpoint.dubboReferences.enabled = false
management.endpoint.dubboProperties.enabled = true
management.endpoint.dubboshutdown.enabled = false
management.endpoint.dubboconfigs.enabled = true
management.endpoint.dubboservices.enabled = false
management.endpoint.dubboreferences.enabled = false
management.endpoint.dubboproperties.enabled = true

# "management.endpoints.web.base-path" should not be configured in this file

# Re-defines path-mapping of Dubbo Web Endpoints
management.endpoints.web.path-mapping.dubboShutdown = dubbo/shutdown
management.endpoints.web.path-mapping.dubboConfigs = dubbo/configs
management.endpoints.web.path-mapping.dubboServices = dubbo/services
management.endpoints.web.path-mapping.dubboReferences = dubbo/references
management.endpoints.web.path-mapping.dubboProperties = dubbo/properties


management.endpoints.web.path-mapping.dubboshutdown = dubbo/shutdown
management.endpoints.web.path-mapping.dubboconfigs = dubbo/configs
management.endpoints.web.path-mapping.dubboservices = dubbo/services
management.endpoints.web.path-mapping.dubboreferences = dubbo/references
management.endpoints.web.path-mapping.dubboproperties = dubbo/properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,25 @@
import com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointsAutoConfiguration;
import com.alibaba.dubbo.config.annotation.Service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;

import java.util.Map;
import java.util.SortedMap;
import java.util.function.Supplier;

/**
* {@link DubboEndpointsAutoConfiguration} Test
*
*
* @since 0.2.0
*/
@RunWith(SpringRunner.class)
Expand All @@ -58,11 +62,12 @@
"dubbo.provider.host=127.0.0.1",
"dubbo.scan.basePackages=com.alibaba.boot.dubbo.actuate.endpoint",
"management.endpoint.dubbo.enabled = true",
"management.endpoint.dubboShutdown.enabled = true",
"management.endpoint.dubboConfigs.enabled = true",
"management.endpoint.dubboServices.enabled = true",
"management.endpoint.dubboReferences.enabled = true",
"management.endpoint.dubboProperties.enabled = true",
"management.endpoint.dubboshutdown.enabled = true",
"management.endpoint.dubboconfigs.enabled = true",
"management.endpoint.dubboservices.enabled = true",
"management.endpoint.dubboreferences.enabled = true",
"management.endpoint.dubboproperties.enabled = true",
"management.endpoints.web.exposure.include = *",
})
@EnableAutoConfiguration
public class DubboEndpointsAutoConfigurationTest {
Expand All @@ -85,6 +90,13 @@ public class DubboEndpointsAutoConfigurationTest {
@Autowired
private DubboShutdownEndpoint dubboShutdownEndpoint;

private RestTemplate restTemplate = new RestTemplate();

@Autowired
private ObjectMapper objectMapper;

@Value("http://127.0.0.1:${local.management.port}${management.endpoints.web.base-path:/actuator}")
private String actuatorBaseURL;

@Test
public void testShutdown() throws Exception {
Expand Down Expand Up @@ -178,20 +190,35 @@ public void testProperties() {
Assert.assertEquals("com.alibaba.boot.dubbo.actuate.endpoint", properties.get("dubbo.scan.basePackages"));
}

@Test
public void testHttpEndpoints() throws JsonProcessingException {
// testHttpEndpoint("/dubbo", dubboEndpoint::invoke);
testHttpEndpoint("/dubbo/configs", dubboConfigsMetadataEndpoint::configs);
testHttpEndpoint("/dubbo/services", dubboServicesMetadataEndpoint::services);
testHttpEndpoint("/dubbo/references", dubboReferencesMetadataEndpoint::references);
testHttpEndpoint("/dubbo/properties", dubboPropertiesEndpoint::properties);
}

@Service(
version = "${dubbo.service.version}",
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)";
private void testHttpEndpoint(String actuatorURI, Supplier<Map> resultsSupplier) throws JsonProcessingException {
String actuatorURL = actuatorBaseURL + actuatorURI;
String response = restTemplate.getForObject(actuatorURL, String.class);
Assert.assertEquals(objectMapper.writeValueAsString(resultsSupplier.get()), response);
}

}

@Service(
version = "${dubbo.service.version}",
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);
Expand Down
4 changes: 2 additions & 2 deletions dubbo-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

<artifactId>dubbo-spring-boot-autoconfigure</artifactId>
<packaging>jar</packaging>
<name>Dubbo Spring Boot AutoConfigure</name>
<description>Dubbo Spring Boot AutoConfigure</description>
<name>Dubbo Spring Boot Auto-Configure</name>
<description>Dubbo Spring Boot Auto-Configure</description>


<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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.samples</groupId>
<artifactId>dubbo-spring-boot-auto-configure-samples</artifactId>
<version>0.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo-spring-boot-auto-configure-consumer-sample</artifactId>
<name>Dubbo Spring Boot Samples : Auto-Configure :: Consumer Sample</name>
<dependencies>

<!-- Spring Boot dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dubbo-spring-boot-sample-api</artifactId>
<version>${project.version}</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.demo.consumer.bootstrap;

import com.alibaba.boot.dubbo.demo.consumer.DemoService;
import com.alibaba.dubbo.config.annotation.Reference;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;

/**
* Dubbo Auto Configuration Consumer Bootstrap
*
* @since 1.0.0
*/
@EnableAutoConfiguration
public class DubboAutoConfigurationConsumerBootstrap {

private final Logger logger = LoggerFactory.getLogger(getClass());

@Reference(version = "1.0.0", url = "dubbo://localhost:12345")
private DemoService demoService;

@Bean
public ApplicationRunner runner() {
return args -> {
logger.info(demoService.sayHello("mercyblitz"));
};
}

public static void main(String[] args) {
SpringApplication.run(DubboAutoConfigurationConsumerBootstrap.class).close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring:
application:
name: dubbo-auto-configure-consumer-sample
Loading