MCPcopy
hub / github.com/apache/dubbo-spring-boot-project

github.com/apache/dubbo-spring-boot-project @2.7.9 sqlite

repository ↗ · DeepWiki ↗ · release 2.7.9 ↗
362 symbols 727 edges 83 files 92 documented · 25%
README

Apache Dubbo Spring Boot Project

Build Status codecov license

Apache Dubbo Spring Boot Project makes it easy to create Spring Boot application using Dubbo as RPC Framework. What's more, it also provides: * auto-configure features (e.g., annotation-driven, auto configuration, externalized configuration). * production-ready features (e.g., security, health checks, externalized configuration).

Apache Dubbo |ˈdʌbəʊ| is a high-performance, light weight, java based RPC framework. Dubbo offers three key functionalities, which include interface based remote call, fault tolerance & load balancing, and automatic service registration & discovery.

中文说明

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.3.0.RELEASE</spring-boot.version>
    <dubbo.version>2.7.8</dubbo.version>
</properties>

<dependencyManagement>
    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring-boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>


        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-dependencies-bom</artifactId>
            <version>${dubbo.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

    </dependencies>
</dependencyManagement>

<dependencies>

    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>2.7.8</version>
    </dependency>    
</dependencies>

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

<repositories>
    <repository>
        <id>apache.snapshots.https</id>
        <name>Apache Development Snapshot Repository</name>
        <url>https://repository.apache.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Legacy Versions

If you still use the legacy Dubbo whose version is less than 2.7.0, please use the following Spring Boot starters:

Dubbo Spring Boot Dubbo Spring Boot
0.2.1.RELEASE 2.6.5+ 2.x
0.1.2.RELEASE 2.6.5+ 1.x

Build from Source

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

  1. Maven install current project in your local repository.

    Maven install = mvn install

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

    ```java @DubboService(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

    ```java @EnableAutoConfiguration public class DubboProviderDemo {

    public static void main(String[] args) {
        SpringApplication.run(DubboProviderDemo.class,args);
    }
    

    } ```

  3. Configures the application.properties:

    ```properties

    Spring boot application

    spring.application.name=dubbo-auto-configuration-provider-demo

    Base packages to scan Dubbo Component: @org.apache.dubbo.config.annotation.Service

    dubbo.scan.base-packages=org.apache.dubbo.spring.boot.sample.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

    ```java @EnableAutoConfiguration public class DubboAutoConfigurationConsumerBootstrap {

    private final Logger logger = LoggerFactory.getLogger(getClass());
    
    @DubboReference(version = "1.0.0", url = "dubbo://127.0.0.1:12345")
    private DemoService demoService;
    
    public static void main(String[] args) {
        SpringApplication.run(DubboAutoConfigurationConsumerBootstrap.class).close();
    }
    
    @Bean
    public ApplicationRunner runner() {
        return args -> {
            logger.info(demoService.sayHello("mercyblitz"));
        };
    }
    

    } ```

  2. configures application.yml

    yaml spring: application: name: dubbo-auto-configure-consumer-sample

If DubboProviderDemo works well, please make 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 the 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 Apache 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:

License

Apache Dubbo spring boot project is under the Apache 2.0 license. See the LICENSE file for details.

Extension points exported contracts — how you extend this code

DemoService (Interface)
Demo Service interface @since 2.7.0 [18 implementers]
dubbo-spring-boot-samples/sample-api/src/main/java/org/apache/dubbo/spring/boot/sample/consumer/DemoService.java

Core symbols most depended-on inside this repo

postProcessEnvironment
called by 10
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java
addDubboConfigBeans
called by 10
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/endpoint/metadata/DubboConfigsMetadata.java
sayHello
called by 9
dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java
of
called by 4
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/AwaitingNonWebApplicationListener.java
resolveBeanMetadata
called by 4
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/endpoint/metadata/AbstractDubboMetadata.java
getStatus
called by 4
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorProperties.java
bind
called by 3
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/RelaxedDubboConfigBinder.java
filterDubboProperties
called by 3
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java

Shape

Method 269
Class 90
Interface 3

Languages

Java100%

Modules by API surface

dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/autoconfigure/DubboConfigurationProperties.java47 symbols
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/AwaitingNonWebApplicationListener.java16 symbols
dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java14 symbols
dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java12 symbols
dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnMultipleConfigTest.java11 symbols
dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboAutoConfigurationOnSingleConfigTest.java10 symbols
dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/context/event/DubboConfigBeanDefinitionConflictApplicationListenerTest.java9 symbols
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessor.java9 symbols
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorProperties.java8 symbols
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicator.java8 symbols
dubbo-spring-boot-compatible/actuator/src/main/java/org/apache/dubbo/spring/boot/actuate/endpoint/metadata/AbstractDubboMetadata.java8 symbols
dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/beans/factory/config/ServiceBeanIdConflictProcessor.java7 symbols

Dependencies from manifests, versioned

ch.qos.logback:logback-classic
com.alibaba.nacos:nacos-client
javax.servlet:javax.servlet-api
org.apache.curator:curator-x-discovery
org.apache.dubbo.samples:dubbo-spring-boot-sample-api
org.apache.dubbo:dubbo-dependencies-bom
org.apache.dubbo:dubbo-dependencies-zookeeper
org.apache.dubbo:dubbo-spring-boot-actuator
org.apache.dubbo:dubbo-spring-boot-actuator-compatible
org.apache.dubbo:dubbo-spring-boot-autoconfigure

For agents

$ claude mcp add dubbo-spring-boot-project \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact