基于CSE开发新的微服务
1、配置maven setting文件以获取SDK依赖。
1、profiles中增加如下配置。
<profile>
<id>nexusProfile</id>
<repositories>
<repository>
<id>cse1</id>
<url>http://maven.huaweicse.com/nexus/content/groups/public/</url>
</repository>
</repositories>
</profile>
2、新增activeProfiles配置。
<activeProfiles>
<activeProfile>nexusProfile</activeProfile>
</activeProfiles>
2、在https://servicestage.huaweicloud.com/servicestage/?project=cn-north-1#/cse/home的“应用开发 > 微服务开发 > 本地工程”页面,创建并下载一个helloworldprovider工程。
3、解压,并在Eclipse导入Maven工程。
1、修改src/main/resources目录下的microservice.yaml文件,用于存放配置信息。
此处按照使用线上服务中心的方式配置。

2、修改代码,作为后期验证的输出。

1、在Eclipse中选中目标工程运行“Run as > Maven install”。
由于网络原因,首次在apache中央仓库下载某些依赖包可能失败,因此首次导入时,可多次执行maven install下载全量依赖包。
2、在helloworldproviderApplication.java上右键执行“Run as > Java Application”。
3、进入界面“应用开发 > 微服务管理 > 服务目录”下就可以看到helloworldprovider微服务。
4、使用浏览器访问http://127.0.0.1:8087/{ServiceName}/helloworld?name=“Tom”,窗口中打印"Welcome, \"Tom\"",表明服务已在正常运行。