Cloud native 与 Spring Cloud 最佳实践

Cloud native 与 Spring Cloud_入门_2_运行后端

请先准备开发环境

1. 下载代码

https://xxxxxxx (下载地址略)

2. 启动数据库

首先启动 Docker

  • 2-1. macOS 或 Linux, 可执行项目中的脚本文件
./documents/scripts/common/db_recreate.sh

如图:

此脚本会自动下载 postgres, 建库建表并插入 demo 数据。

  • 2-2. 如果你是 Windows, 执行如下命令
docker-compose up -d postgres
3. 从 Eclipse 导入 xxxCloud 项目
  • File > Import > Existing Maven projects …
  • 选择 xxxCloud 目录
  • 在 Boot Dashboard 中选中相应的微服务,点击 Run 按钮
4. 测试 REST API
  • 浏览器输入: http://localhost:8001/swagger-ui.html
  • 选择任一 API,以GET /api/v1/products为例, 点击try it out
  • 点击Execute