You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "mercyblitz (GitHub)" <gi...@apache.org> on 2018/12/07 03:16:34 UTC

[GitHub] [incubator-dubbo-spring-boot-project] mercyblitz commented on issue #305: 现在dubbo已经支持REST,这个配置怎么时间跟进,同时发布RPC和REST服务那种#235

You can export two protocols, please add those properties to your `application.properties`:

```properties
dubbo.protocols.dubbo.name = dubbo
dubbo.protocols.dubbo.port = 20880

dubbo.protocols.rest.name = rest
dubbo.protocols.rest.port = 8080
```

Then, declare above protocols on `@Service`:

```java
@Service(protocols={"dubbo","rest"})
public class UserServiceImpl implement UserService {
    @GET
    @Path("{id : \\d+}")
    @Produces({MediaType.APPLICATION_JSON})
    public User getUser(@PathParam("id") Long id) {
        // ...
    }
}
```

`UserServiceImpl` will be exported "dubbo" and "rest" services for consumers.






[ Full content available at: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/305 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org