腾讯云授权服务中心
五万用户的选择,您身边的云计算顾问
发布日:2022-05-22 14:01 阅读数:
<!-- 盘古 Parent -->
<parent>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-parent</artifactId>
<version>latest.version.xxx</version>
<relativePath/>
</parent>
<!-- 基础模块 -->
<dependency>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-spring-boot-starter</artifactId>
</dependency>
<!-- Dubbo模块 -->
<dependency>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-dubbo-spring-boot-starter</artifactId>
</dependency>
<!-- 服务接口包 -->
<dependency>
<groupId>com.gitee.pulanos.pangu</groupId>
<artifactId>pangu-examples-dubbo-api</artifactId>
<version>1.0.0</version>
</dependency>
UserEntity findUserEntity(Long id);
@Service(version = "1.0.0", group = "pangu-showcases-dubbo-service")
public class UserServiceImpl implements UserService {
@Override
public UserEntity findUserEntity(Long id) {
log.info("参数ID:{}", id);
UserEntity userEntity = new UserEntity();
userEntity.setId(id);
userEntity.setName("云南码农大熊");
return userEntity;
}
}
@EnableDubbo
@SpringBootApplication
public class DubboProviderApplication {
public static void main(String[] args) {
PanGuApplicationBuilder.init(DubboProviderApplication.class).run(args);
}
}
-Dnacos.server-addr=127.0.0.1:8848 -Dnacos.namespace=pangu-dev
@Component
public class UserAdminManager {
@Reference(version = "1.0.0", group = "pangu-examples-dubbo-service")
private UserService userService;
public void findUserEntityById(Long id){
log.info("开始Dubbo远程调用...");
UserEntity userEntity = userService.findUserEntity(id);
log.info("[OK] 调用成功 {}", userEntity);
}
}
编辑:航网科技 来源:腾讯云
本文版权归原作者所有 转载请注明出处
Copyright © 2011-2020 www.hangw.com. All Rights Reserved 深圳航网科技有限公司 版权所有 增值电信业务经营许可证:粤B2-20201122 - 粤ICP备14085080号
微信扫一扫咨询客服
全国免费服务热线
0755-36300002