Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alibaba/dubbo-spring-boot-starter
Dubbo Spring Boot Starter
https://github.com/alibaba/dubbo-spring-boot-starter
dubbo spring-boot
Last synced: about 2 months ago
JSON representation
Dubbo Spring Boot Starter
- Host: GitHub
- URL: https://github.com/alibaba/dubbo-spring-boot-starter
- Owner: alibaba
- License: apache-2.0
- Archived: true
- Created: 2017-01-20T08:02:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-14T10:43:15.000Z (over 6 years ago)
- Last Synced: 2024-05-21T04:57:10.448Z (6 months ago)
- Topics: dubbo, spring-boot
- Language: Java
- Homepage:
- Size: 79.1 KB
- Stars: 2,099
- Watchers: 200
- Forks: 747
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
dubbo-spring-boot-starter [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.alibaba.spring.boot/dubbo-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba.spring.boot/dubbo-spring-boot-starter)
===================================[中文版文档](https://github.com/alibaba/dubbo-spring-boot-starter/blob/master/README_zh.md)
Dubbo Spring Boot Starter. Dubbo official [dubbo-spring-boot-project](https://github.com/dubbo/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:
```xml
com.alibaba.spring.boot
dubbo-spring-boot-starter
2.0.0
```
* add dubbo configuration in application.properties, demo:```properties
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)
```java
@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.
```java
@Service(interfaceClass = IHelloService.class)
@Component
public class HelloServiceImpl implements IHelloService {
//...
}
```* Start Spring Boot.
### How to consume Dubbo
* add Dependencies:
```xml
com.alibaba.spring.boot
dubbo-spring-boot-starter
2.0.0
```* add dubbo configuration in application.properties, demo:
```properties
spring.application.name=dubbo-spring-boot-starter
```* then add `@EnableDubboConfiguration` on Spring Boot Application
```java
@SpringBootApplication
@EnableDubboConfiguration
public class DubboConsumerLauncher {
//...
}
```* injection interface by the `@Reference` annotation.
```java
@Component
public class HelloConsumer {
@Reference(url = "dubbo://127.0.0.1:20880")
private IHelloService iHelloService;}
```### Reference
* dubbo: http://dubbo.io
* spring-boot: http://projects.spring.io/spring-boot
* dubbo-spring-boot-project: https://github.com/dubbo/dubbo-spring-boot-project