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

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

mercyblitz commented on issue #305: 现在dubbo已经支持REST,这个配置怎么时间跟进,同时发布RPC和REST服务那种#235
URL: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/305#issuecomment-445109338
 
 
   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.
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org