Giter VIP home page Giter VIP logo

dubbo's Introduction

dubbo's People

Contributors

beiwei30 avatar biyuhao avatar carryxyh avatar chickenlj avatar codingsinger avatar crazyhzm avatar cvictory avatar ezkayotwjprkxwcuyeeb avatar haiyang1985 avatar hengyunabc avatar htynkn avatar jerrick-zhu avatar kexianjun avatar kezhenxu94 avatar kiminotes avatar kun-song avatar liangfei0201 avatar lioswong avatar lizhennet avatar lovepoem avatar manzhizhen avatar mercyblitz avatar moriadry avatar oldratlee avatar qinliujie avatar ralf0131 avatar slievrly avatar tswstarplanet avatar wanghbxxxx avatar zonghaishang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dubbo's Issues

Spring Web MVC support for Dubbo Service Provider

Adding support for Dubbo's Service Provider in Spring Web MVC application without any @Controller.

Service Provider demo code :

@Service(
        version = "${demo.service.version}",
        application = "${dubbo.application.id}",
        protocol = "${dubbo.protocol.id}",
        registry = "${dubbo.registry.id}"
)
@RestService
public class DefaultDemoService implements DemoService {

    @RequestMapping("/say-hello")
    public String sayHello(String name) {
        return "Hello, " + name + " (from Spring Boot)";
    }

}

@RestService that is a meta-annotation declares current Dubbo's service exporting HTTP REST under Spring WebMVC, and it's required enabled by @EnableRestService in your @Configuration class , as follow:

@EnableRestService
public class WebMvcConfiguration {
}

Dubbo REST 支持调研

Dubbo REST 支持主要有两部分的考虑:

  1. HTTP Web 服务
  • Servlet:绝大多数 Web 应用基于 Java Servlet 规范开发,因此可以考虑 Servlet 3.0 +的自动装配
  • Netty :目前 Dubbo 直接依赖了 Netty 框架,也可以考虑支持嵌入式 Netty Web 容器
  1. REST 处理
  • JAX-RS: JAX-RS 是 JSR REST 标准,目前参考实现jersey 提供了完整的支持,比如:Netflix 处理 REST 也基于此,支持标准是必然的趋势
  • Spring Web MVC :Spring Web MVC 基本上属于事实的标准,经过了大量的线上应用测试,各方面表现良好,没有不支持的理由
  1. 可选支持:
  1. 开源支持:

@com.alibaba.dubbo.config.annotation.Service 注解属性方法支持占位符

支持占位符,代码如下:

Property 占位符定义:META-INF/default.properties

demo.service.version = 2.5.7
demo.service.application = dubbo-annotation-provider
demo.service.protocol = dubbo
demo.service.registry = my-registry

装载 Property 配置Bean:ProviderConfiguration

@DubboComponentScan(basePackages = "com.alibaba.dubbo.config.spring.context.annotation")
@ImportResource("META-INF/spring/dubbo-annotation-provider.xml")
@PropertySource("META-INF/default.properties")
public class ProviderConfiguration {
}

应用占位符:DemoServiceImpl

@com.alibaba.dubbo.config.annotation.Service(
        version = "${demo.service.version}",
        application = "${demo.service.application}",
        protocol = "${demo.service.protocol}",
        registry = "${demo.service.registry}"
)
public class DemoServiceImpl implements DemoService {

    @Override
    public String sayName(String name) {
        return "Hello," + name;
    }

    @Override
    public Box getBox() {
        return new Box() {
            @Override
            public String getName() {
                return "MyBox";
            }
        };
    }
}

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.