UserService.Java
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;
@Service// 注入容器中,用spring的注解
public class UserService {
//要拿到provider-service提供的票,要去注册中心
@Reference //引用,导入dubbo的包。正常开发引用pom坐标,但是可以定义路径相同的接口名
TicketService ticketService;
public void buyTicket(){
String ticket = ticketService.getTicket();
System.out.println("在注册中心拿到=》"+ticket);
}
}