GithubHelp home page GithubHelp logo

kiddofun / dubbo-spring-boot-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/dubbo-spring-boot-starter

0.0 1.0 0.0 81 KB

Dubbo Spring Boot Starter

License: Apache License 2.0

Java 100.00%

dubbo-spring-boot-starter's Introduction

dubbo-spring-boot-starter Maven Central

中文版文档

Dubbo Spring Boot Starter. Dubbo official dubbo-spring-boot-project

Support jdk version 1.6 or 1.6+

(please import googlestyle-java.xml if you want to modify the code)

How to publish dubbo

  • add Dependencies:
    <dependency>
        <groupId>com.alibaba.spring.boot</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>2.0.0</version>
    </dependency>
  • add dubbo configuration in application.properties, demo:
spring.application.name=dubbo-spring-boot-starter
spring.dubbo.server=true
spring.dubbo.registry=N/A
  • then add @EnableDubboConfiguration on Spring Boot Application, indicates that dubbo is enabled.(web or non-web application can use dubbo provider)
@SpringBootApplication
@EnableDubboConfiguration
public class DubboProviderLauncher {
  //...
}
  • code your dubbo service, add @Service(import com.alibaba.dubbo.config.annotation.Service) on your service class, and interfaceClass is the interface which will be published.
@Service(interfaceClass = IHelloService.class)
@Component
public class HelloServiceImpl implements IHelloService {
  //...
}
  • Start Spring Boot.

How to consume Dubbo

  • add Dependencies:
    <dependency>
        <groupId>com.alibaba.spring.boot</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>2.0.0</version>
    </dependency>
  • add dubbo configuration in application.properties, demo:
spring.application.name=dubbo-spring-boot-starter
  • then add @EnableDubboConfiguration on Spring Boot Application
@SpringBootApplication
@EnableDubboConfiguration
public class DubboConsumerLauncher {
  //...
}
  • injection interface by the @Reference annotation.
@Component
public class HelloConsumer {
  @Reference(url = "dubbo://127.0.0.1:20880")
  private IHelloService iHelloService;

}

Reference

dubbo-spring-boot-starter's People

Contributors

alibaba-oss avatar hanwangkun avatar ivan97 avatar xionghuicoder avatar yanchang-gyc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.