首页
学习
活动
专区
圈层
工具
发布

Spring Cloud 微服务(五):快速开始

本文介绍如何在本地快速启动微服务项目。

1. 前提条件

本地需要安装 jdk 11 及以上。

2. 检出源码

代码语言:javascript
复制
# 检出微服务源码
$ git clone https://github.com/peacetrue/peacetrue-microservice-template
# 检出远程仓库源码
$ git clone https://github.com/peacetrue/peacetrue-microservice-config-repo-template

以上两个项目需放在同一目录下,并且不能更改项目名。

3. 启动应用

打开 peacetrue-microservice-template 项目,可以看到如下项目结构:

Figure 1. 项目结构

依次启动模块:

  1. peacetrue-microservice-config-center:8888
  2. peacetrue-microservice-registry-center:8761
  3. peacetrue-microservice-uaa:8080
  4. peacetrue-microservice-resource-server:8520
  5. peacetrue-microservice-client-inner:8530
  6. peacetrue-microservice-gateway:80
  7. peacetrue-microservice-client-outer:8531

peacetrue-microservice-uaa 需要部署到 Tomcat 启动(参考 UAA安装部署),其他模块都是从 *Application 类启动。如启动失败,请检查端口是否被占用。

4. 查看应用状态

所有应用账号密码都是 peacetrue/password。

依次打开各个应用,查看运行情况:

  • http://localhost:8888/actuator/health
  • http://localhost:8761/actuator/health
  • http://localhost:8080/uaa
  • http://localhost:8520/actuator/health
  • http://localhost:8530/actuator/health
  • http://localhost/actuator/health
  • http://localhost:8531/actuator/health

5. 内部客户端-授权码认证流程

参考 演示效果

6. 外部客户端-客户端凭据认证流程

参考 演示效果

下一篇
举报
领券