Skip to content

Commit

Permalink
0.2.1 (#357)
Browse files Browse the repository at this point in the history
* Fix #169

* Polish : #324 & #325

* Polish : #315

* Polish : #321

* Polish : #321

* Polish : #321 for test case

* Polish : Update Demos

* Polish : Update version to be 0.2.1

* Polish : #319

* Polish : #226

* Polish : #309

* Fix the test case's bugs

* Fix the test case's bugs

* Fix a JavaDoc issue

* Update SNAPSHOT and add exclude list

* Update SNAPSHOT to be 0.2.1-SNAPSHOT

* Update JDK versions

* Update JDK versions

* Reactor & remove author info

* Refactor : to save a shutdown hook thread

* Remove javax.servlet:javax.servlet-api:3.1.0 that may cause class conflict, and use indirectly dependencies from spring-boot-starter-*

* Polish #341

* Add the samples

* Add a license
  • Loading branch information
mercyblitz authored Jan 7, 2019
1 parent 7021e60 commit 4cadcb6
Show file tree
Hide file tree
Showing 22 changed files with 436 additions and 216 deletions.
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
38 changes: 38 additions & 0 deletions dubbo-spring-boot-samples/auto-configure-samples/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
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-samples</artifactId>
<version>0.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo-spring-boot-auto-configure-samples</artifactId>
<name>Dubbo Spring Boot Samples : Auto-Configure</name>
<description>Dubbo Spring Boot Auto-Configure Samples</description>
<packaging>pom</packaging>

<modules>
<module>consumer-sample</module>
<module>provider-sample</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,31 @@
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"
<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</groupId>
<artifactId>dubbo-spring-boot-samples</artifactId>
<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-sample-consumer</artifactId>
<name>Dubbo Spring Boot Sample : Consumer</name>
<artifactId>dubbo-spring-boot-auto-configure-provider-sample</artifactId>
<name>Dubbo Spring Boot Samples : Auto-Configure :: Provider Sample</name>

<dependencies>

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

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

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

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

Expand Down Expand Up @@ -83,4 +72,5 @@
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@
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.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;

/**
* Dubbo Provider Demo
* Dubbo Auto-Configuration Provider Bootstrap
*
* @author <a href="mailto:[email protected]">Mercy</a>
* @see DefaultDemoService
* @since 1.0.0
*/
@SpringBootApplication
public class DubboProviderDemo {
@EnableAutoConfiguration
public class DubboAutoConfigurationProviderBootstrap {

public static void main(String[] args) {

new SpringApplicationBuilder(DubboProviderDemo.class)
new SpringApplicationBuilder(DubboAutoConfigurationProviderBootstrap.class)
.web(WebApplicationType.NONE)
.run(args);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,24 @@
import com.alibaba.boot.dubbo.demo.consumer.DemoService;
import com.alibaba.dubbo.config.annotation.Service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import org.springframework.beans.factory.annotation.Value;

/**
* Default {@link DemoService}
*
* @author <a href="mailto:[email protected]">Mercy</a>
* @see DemoService
* @since 1.0.0
*/
@Service(
version = "${demo.service.version}",
protocol = {"dubbo", "rest"},
registry = "${dubbo.registry.id}"
)
@Path("demo")
@Service(version = "1.0.0")
public class DefaultDemoService implements DemoService {

@GET
@Path("/say-hello")
public String sayHello(@QueryParam("name") String name) {
return "Hello, " + name + " (from Spring Boot)";
/**
* The default value of ${dubbo.application.name} is ${spring.application.name}
*/
@Value("${dubbo.application.name}")
private String serviceName;

public String sayHello(String name) {
return String.format("[%s] : Hello, %s", serviceName, name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Spring boot application
spring.application.name=dubbo-auto-configuration-provider-demo
# Base packages to scan Dubbo Component: @com.alibaba.dubbo.config.annotation.Service
dubbo.scan.base-packages=com.alibaba.boot.dubbo.demo.provider.service
# Dubbo Application
## The default value of dubbo.application.name is ${spring.application.name}
## dubbo.application.name=${spring.application.name}
# Dubbo Protocol
dubbo.protocol.name=dubbo
dubbo.protocol.port=12345
## Dubbo Registry
dubbo.registry.address=N/A

This file was deleted.

Loading

0 comments on commit 4cadcb6

Please sign in to comment.