0.2.1 (#389)

* 0.2.1 (#372)

* Fix apache/incubator-dubbo-spring-boot-project#169

* Polish : apache/incubator-dubbo-spring-boot-project#324 & apache/incubator-dubbo-spring-boot-project#325

* Polish : apache/incubator-dubbo-spring-boot-project#315

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321 for test case

* Polish : Update Demos

* Polish : Update version to be 0.2.1

* Polish : apache/incubator-dubbo-spring-boot-project#319

* Polish : apache/incubator-dubbo-spring-boot-project#226

* Polish : apache/incubator-dubbo-spring-boot-project#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 apache/incubator-dubbo-spring-boot-project#341

* Add the samples

* Add a license

* Add the samples of Zookeeper and Nacos

* Update README.md

* Fix the test cases

* Polish apache/incubator-dubbo-spring-boot-project#366

* Polish apache/incubator-dubbo-spring-boot-project#370

* 0.2.1 (#376)

* Fix apache/incubator-dubbo-spring-boot-project#169

* Polish : apache/incubator-dubbo-spring-boot-project#324 & apache/incubator-dubbo-spring-boot-project#325

* Polish : apache/incubator-dubbo-spring-boot-project#315

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321 for test case

* Polish : Update Demos

* Polish : Update version to be 0.2.1

* Polish : apache/incubator-dubbo-spring-boot-project#319

* Polish : apache/incubator-dubbo-spring-boot-project#226

* Polish : apache/incubator-dubbo-spring-boot-project#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 apache/incubator-dubbo-spring-boot-project#341

* Add the samples

* Add a license

* Add the samples of Zookeeper and Nacos

* Update README.md

* Fix the test cases

* Polish apache/incubator-dubbo-spring-boot-project#366

* Polish apache/incubator-dubbo-spring-boot-project#370

* Polish apache/incubator-dubbo-spring-boot-project#370

* 0.2.1 (#386)

* Fix apache/incubator-dubbo-spring-boot-project#169

* Polish : apache/incubator-dubbo-spring-boot-project#324 & apache/incubator-dubbo-spring-boot-project#325

* Polish : apache/incubator-dubbo-spring-boot-project#315

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321

* Polish : apache/incubator-dubbo-spring-boot-project#321 for test case

* Polish : Update Demos

* Polish : Update version to be 0.2.1

* Polish : apache/incubator-dubbo-spring-boot-project#319

* Polish : apache/incubator-dubbo-spring-boot-project#226

* Polish : apache/incubator-dubbo-spring-boot-project#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 apache/incubator-dubbo-spring-boot-project#341

* Add the samples

* Add a license

* Add the samples of Zookeeper and Nacos

* Update README.md

* Fix the test cases

* Polish apache/incubator-dubbo-spring-boot-project#366

* Polish apache/incubator-dubbo-spring-boot-project#370

* Polish apache/incubator-dubbo-spring-boot-project#370

* Add NOTICE and DISCLAIMER
2 files changed
tree: f910e4c05f0c412182984b034f15d872a6df37fa
  1. .gitignore
  2. .mvn/
  3. .travis.yml
  4. DISCLAIMER
  5. LICENSE
  6. NOTICE
  7. README.md
  8. README_CN.md
  9. config-popup-window.png
  10. dubbo-spring-boot-actuator/
  11. dubbo-spring-boot-autoconfigure/
  12. dubbo-spring-boot-distribution/
  13. dubbo-spring-boot-parent/
  14. dubbo-spring-boot-samples/
  15. dubbo-spring-boot-starter/
  16. mconfig-popup-window.png
  17. mvnw
  18. mvnw.cmd
  19. pom.xml
README.md

Dubbo Spring Boot Project

Build Status codecov Gitter license maven

Apache Dubbo(incubating) Spring Boot Project makes it easy to create Spring Boot application using Dubbo as RPC Framework. What's more, it aslo provides

Apache Dubbo(incubating) is a high-performance, java based RPC framework open-sourced by Alibaba. As in many RPC systems, dubbo is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types. On the server side, the server implements this interface and runs a dubbo server to handle client calls. On the client side, the client has a stub that provides the same methods as the server.

中文说明

Released version

You can introduce the latest dubbo-spring-boot-starter to your project by adding the following dependency to your pom.xml

<properties>
    <spring-boot.version>2.1.1.RELEASE</spring-boot.version>
    <dubbo.version>2.6.5</dubbo.version>
</properties>
    
<dependencyManagement>
    <dependencies>
        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring-boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    
        <!-- Dubbo dependencies -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo-dependencies-bom</artifactId>
            <version>${dubbo.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <!-- Dubbo Spring Boot Starter -->
    <dependency>
        <groupId>com.alibaba.boot</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>0.2.1</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>${dubbo.version}</version>
    </dependency>
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
    </dependency>
</dependencies>

If your project failed to resolve the dependency, try to add the following repository:

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Developing Versions

For now, dubbo-spring-boot-starter will separate two versions for Spring Boot 2.x and 1.x once release :

  • 0.2.x is a main stream release version for Spring Boot 2.x

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

Build from Source

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

  1. Maven install current project in your local repository.

Maven install = mvn install

Dependencies

versionsJavaSpring BootDubbo
0.2.11.8+2.1.x2.6.2 +
0.1.11.7+1.5.x2.6.2 +

Getting Started

If you don't know about Dubbo, please take a few minutes to learn http://dubbo.apache.org/. After that you could dive deep into dubbo user guide.

Usually, There are two usage scenarios for Dubbo applications, one is Dubbo service(s) provider, another is Dubbo service(s) consumer, thus let's get a quick start on them.

First of all, we suppose an interface as Dubbo RPC API that a service provider exports and a service client consumes:

public interface DemoService {

    String sayHello(String name);

}

Dubbo service(s) provider

  1. Service Provider implements DemoService

    @Service(version = "1.0.0")
    public class DefaultDemoService implements DemoService {
    
        /**
        * 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);
        }
    }
    
  2. Provides a bootstrap class

    @EnableAutoConfiguration
    public class DubboProviderDemo {
    
        public static void main(String[] args) {
            SpringApplication.run(DubboProviderDemo.class,args);
        }
    }
    
  3. Configures the application.properties:

    # 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
    

Dubbo service(s) consumer

  1. Service consumer also provides a bootstrap class to reference DemoService

    @EnableAutoConfiguration
    public class DubboConsumerBootstrap {
    
        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(DubboConsumerBootstrap.class).close();
        }
    }
    
  2. configures application.properties

    # Spring boot application
    spring.application.name = dubbo-consumer-demo
    server.port = 8080
    management.port = 8081
    
    
    # Dubbo Config properties
    ## ApplicationConfig Bean
    dubbo.application.id = dubbo-consumer-demo
    dubbo.application.name = dubbo-consumer-demo
    
    ## ProtocolConfig Bean
    dubbo.protocol.id = dubbo
    dubbo.protocol.name = dubbo
    dubbo.protocol.port = 12345
    

If DubboProviderDemo works well, please mark sure DubboProviderDemo is started.

More details, please refer to Samples.

Getting help

Having trouble with Dubbo Spring Boot? We’d like to help!

Building from Source

If you want to try out thr latest features of Dubbo Spring Boot, it can be easily built with the maven wrapper. Your JDK is 1.8 or above.

$ ./mvnw clean install

Modules

There are some modules in Dubbo Spring Boot Project, let's take a look at below overview:

dubbo-spring-boot-parent

The main usage of dubbo-spring-boot-parent is providing dependencies management for other modules.

dubbo-spring-boot-autoconfigure

dubbo-spring-boot-autoconfigure uses Spring Boot‘s @EnableAutoConfiguration which helps core Dubbo’s components to be auto-configured by DubboAutoConfiguration. It reduces code, eliminates XML configuration.

dubbo-spring-boot-actuator

dubbo-spring-boot-actuator provides production-ready features (e.g., health checks, endpoints, and externalized configuration).

dubbo-spring-boot-starter

dubbo-spring-boot-starter is a standard Spring Boot Starter, which contains dubbo-spring-boot-autoconfigure and dubbo-spring-boot-actuator. It will be imported into your application directly.

dubbo-spring-boot-samples

The samples project of Dubbo Spring Boot that includes: