@Service

  1. import org.apache.dubbo.config.annotation.Service;
  2. @Service(version = "async", protocol = "p1")
  3. public class AsyncDemoService implements DemoService {

在类上面定义了一个@Service注解,就相当于定义了一个dubbo服务,

这个注解的作用就相当于xml

注意这个@Service注解和SpringMVC的@Service注解是两个注解.

这个@Service注解会将这个服务注册到注册中心上面去