# SpringCloudDemo **Repository Path**: netidol/SpringCloudDemo ## Basic Information - **Project Name**: SpringCloudDemo - **Description**: 基于Spring Cloud Eureka的微服务注册,发现以及简单网关Demo - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-05-29 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SpringCloud 基于springcloud搭建的微服务程序 ##目录说明 ├─discovery //注册中心 │ ├─src │ │ └─main │ │ ├─java │ │ │ └─discovery │ │ └─resources //资源配置文件 │ └─target │ ├─classes │ │ └─discovery │ ├─generated-sources │ │ └─annotations │ ├─maven-archiver │ └─maven-status │ └─maven-compiler-plugin │ └─compile │ └─default-compile ├─gateway //服务网关方式一(推荐) │ ├─src │ │ └─main │ │ ├─java │ │ │ └─gateway │ │ └─resources //资源配置文件 │ └─target │ ├─classes │ │ └─gateway │ ├─generated-sources │ │ └─annotations │ ├─maven-archiver │ └─maven-status │ └─maven-compiler-plugin │ └─compile │ └─default-compile ├─ribbon-consumer //服务网关方式二(不推荐) │ ├─.mvn │ │ └─wrapper │ ├─src │ │ ├─main │ │ │ ├─java │ │ │ │ └─com │ │ │ │ └─tangchen │ │ │ │ └─ribbonconsumer │ │ │ └─resources │ │ └─test │ │ └─java │ │ └─com │ │ └─tangchen │ │ └─ribbonconsumer │ └─target │ ├─classes │ │ └─com │ │ └─tangchen │ │ └─ribbonconsumer │ ├─generated-sources │ │ └─annotations │ ├─generated-test-sources │ │ └─test-annotations │ └─test-classes │ └─com │ └─tangchen │ └─ribbonconsumer ├─service //服务提供者,样例较全 │ ├─src │ │ └─main │ │ ├─java │ │ │ └─service │ │ └─resources │ └─target │ ├─classes │ │ └─service │ ├─generated-sources │ │ └─annotations │ ├─maven-archiver │ └─maven-status │ └─maven-compiler-plugin │ └─compile │ └─default-compile └─service2 //服务提供者 ├─src │ └─main │ ├─java │ │ └─service2 │ └─resources └─target ├─classes │ └─service2 ├─generated-sources │ └─annotations ├─maven-archiver └─maven-status └─maven-compiler-plugin └─compile └─default-compile ## 使用技术 - 版本:springcloud Camden.SR6 - 注册中心:eureka ## 项目结构 - 注册中心 discovery - 服务1 service - 服务2 service2 - 网关 gateway ## 启动项目 1. 启动discovery 2. 启动service 3. 启动service2 4. 启动gateway ##访问项目 http://loacalhost:8081 http://loacalhost:8082/service http://loacalhost:8083/service2 http://loacalhost:8084/service2/service2 http://loacalhost:8084/service/service ##界面截图 ![](https://i.imgur.com/M30M4DT.png) ## 实现功能 通过注册中心的配置,可以在gateway模块,访问service和service2模块上的接口。