| Language | Framework | Platform |
|---|---|---|
| Java | CSE Spring MVC | ServiceStage Container, CCE Cluster |
This sample code helps get you started with a simple Java CSE microservice deployed by ServiceStage Container App to a CCE Cluster.
This sample includes:
README.mdLICENSEDockerfilepom.xml- this file is the Maven Project Object Model for the microservicesrc/main- this directory contains your Java service source filessrc/test- this directory contains your Java service unit test files
see Precondition
Clone your code repository and start developing your application on IDE of your choice
-
Install maven. See https://maven.apache.org/install.html for details.
-
Download
local-service-centerfrom http://servicecomb.incubator.apache.org/release/. ReadREADME.mdto startlocal-service-center.Or download
Local-CSEfrom Local Lightweight Microservice Engine. -
Update the service registry address in
microservice.yamlaccording to theREADME.mdinlocal-service-center. -
Build the application.
mvn -f pom.xml package
-
Run the application in IDE or execute the jar.
-
Open http://127.0.0.1:8080/rest/helloworld?name=hellworld in a web browser to view your application.
if you want to deploy the sample code on servicestage, View your CI/CD pipeline and service stack on ServiceStage and customize it as per your needs
| 语言 | 框架 | 平台 |
|---|---|---|
| Java | CSE Spring MVC | ServiceStage 容器, CCE 集群 |
本示例代码帮助您开始使用一个简单的 Java CSE 微服务,该服务通过 ServiceStage 容器应用部署到 CCE 集群。
本示例包含:
README.mdLICENSEDockerfilepom.xml- 这个文件是微服务的 Maven 项目对象模型src/main- 这个目录包含您的 Java 服务源文件src/test- 这个目录包含您的 Java 服务单元测试文件
参见前置条件
克隆您的代码仓库,并在您选择的 IDE 上开始开发应用
-
安装 maven。详情请参见 https://maven.apache.org/install.html。
-
从 http://servicecomb.incubator.apache.org/release/ 下载
local-service-center。 阅读README.md来启动local-service-center。或从本地轻量化微服务引擎下载
Local-CSE。 -
根据
local-service-center中的README.md更新microservice.yaml中的服务注册地址。 -
构建应用。
mvn -f pom.xml package
-
在 IDE 中运行应用或执行 jar 包。
-
在网络浏览器中打开 http://127.0.0.1:8080/rest/helloworld?name=hellworld 来查看您的应用。
如果您想在 servicestage 上部署示例代码,请查看您在 ServiceStage 上的 CI/CD 流水线和服务堆栈,并根据需要进行自定义。