{"id":50980829,"url":"https://github.com/javahongxi/spring-cloud-samples","last_synced_at":"2026-06-19T14:02:01.776Z","repository":{"id":105323667,"uuid":"341704789","full_name":"javahongxi/spring-cloud-samples","owner":"javahongxi","description":"Spring Cloud 生态研究（Based on Spring Boot 4.x and Spring Cloud Alibaba 2025.1.x） ☁️","archived":false,"fork":false,"pushed_at":"2026-06-15T03:03:32.000Z","size":398,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-15T03:19:20.812Z","etag":null,"topics":["dubbo","nacos","rocketmq","sentinel","spring-cloud","spring-cloud-alibaba","spring-cloud-gateway","spring-cloud-stream"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javahongxi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-23T22:12:27.000Z","updated_at":"2026-06-15T03:03:36.000Z","dependencies_parsed_at":"2023-04-29T17:19:13.088Z","dependency_job_id":null,"html_url":"https://github.com/javahongxi/spring-cloud-samples","commit_stats":null,"previous_names":["javahongxi/spring-cloud-samples"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/javahongxi/spring-cloud-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javahongxi%2Fspring-cloud-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javahongxi%2Fspring-cloud-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javahongxi%2Fspring-cloud-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javahongxi%2Fspring-cloud-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javahongxi","download_url":"https://codeload.github.com/javahongxi/spring-cloud-samples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javahongxi%2Fspring-cloud-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34534278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dubbo","nacos","rocketmq","sentinel","spring-cloud","spring-cloud-alibaba","spring-cloud-gateway","spring-cloud-stream"],"created_at":"2026-06-19T14:01:57.289Z","updated_at":"2026-06-19T14:02:01.765Z","avatar_url":"https://github.com/javahongxi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Cloud Alibaba Samples\nSpring Cloud 生态研究（Based on **Spring Boot 4.x** and **Spring Cloud Alibaba 2025.1.x**） \u003cbr\u003e\n以生产环境可参考为目标，打造一个完整的 Spring Cloud 示例项目。\n\n### 模块介绍\n| 模块                             | 简称                | 端口    | 说明                    |\n|--------------------------------|-------------------|-------|-----------------------|\n| cloud-gateway-sample           | gateway           | 8764  | Spring Cloud Gateway  |\n| cloud-consumer-sample          | consumer          | 8766  | Web Consumer          |\n| cloud-provider-sample          | provider          | 8765  | Web Provider          |\n| cloud-consumer-reactive-sample | consumer-reactive | 8763  | Reactive Web Consumer |\n| cloud-provider-reactive-sample | provider-reactive | 8762  | Reactive Web Provider |\n| cloud-provider-dubbo-sample    | provider-dubbo    | 50051 | Dubbo Provider        |\n| cloud-consumer-dubbo-sample    | consumer-dubbo    | -     | Dubbo Consumer        |\n| cloud-sample-api               | api               | -     | interface             |\n| cloud-nacos-config-sample      | config            | 8761  | Nacos Config          |\n| cloud-stream-sample            | stream            | -     | Spring Cloud Stream   |\n\n\u003cpicture\u003e\n  \u003csource srcset=\"arch.svg\" type=\"image/svg+xml\"\u003e\n  \u003cimg src=\"arch.png\" alt=\"架构图\"\u003e\n\u003c/picture\u003e\n\n### 服务注册与发现演示\n首先安装部署nacos，请参考 nacos.io\n\n#### 普通Web服务的注册与发现\n依次启动provider,consumer,gateway \u003cbr\u003e\n直接访问(consumer → provider)\n```shell\ncurl 'http://localhost:8766/hi?name=hongxi'\n```\n通过网关访问(gateway → consumer → provider)\n```shell\ncurl 'http://localhost:8764/consumer-sample/hi?name=hongxi'\n```\n\n#### Reactive Web 服务注册与发现\n接着启动provider-reactive,consumer-reactive \u003cbr\u003e\n直接访问(consumer-reactive → provider-reactive)\n```shell\ncurl 'http://localhost:8763/hi?name=hongxi'\n```\n通过网关访问(gateway → consumer-reactive → provider-reactive)\n```shell\ncurl 'http://localhost:8764/consumer-reactive-sample/hi?name=hongxi'\n```\n\n#### dubbo 服务注册与发现\n接着启动provider-dubbo \u003cbr\u003e\n直接访问(consumer → provider-dubbo)\n```shell\ncurl 'http://localhost:8766/dubbo?name=hongxi'\n```\n通过网关访问(gateway → consumer → provider-dubbo)\n```shell\ncurl 'http://localhost:8764/consumer-sample/dubbo?name=hongxi'\n```\n直接访问(consumer-reactive → provider-dubbo)\n```shell\ncurl 'http://localhost:8763/dubbo?name=hongxi'\n```\n通过网关访问(gateway → consumer-reactive → provider-dubbo)\n```shell\ncurl 'http://localhost:8764/consumer-reactive-sample/dubbo?name=hongxi'\n```\n\n### 脚本演示\n启动所有服务（脚本最后会执行curl并输出响应结果）\n```shell\nsh start-all.sh\n```\n停止所有服务\n```shell\nsh start-all.sh stop\n```\n\n### 网关访问dubbo演示\n启动provider-dubbo,gateway\u003cbr\u003e\n直接访问`dubbo rest`接口\n```shell\ncurl http://localhost:50051/api/hello/lily\ncurl 'http://localhost:50051/api/add?a=1\u0026b=2'\ncurl -X POST http://localhost:50051/api/echo -H \"Content-Type: application/json\" -d '{\"message\":\"hi\"}'\ncurl 'http://localhost:50051/api/greet/lily?lang=zh'\n```\n通过网关访问`dubbo rest`接口(gateway → provider-dubbo)\n```shell\ncurl http://localhost:8764/provider-dubbo-sample/api/hello/lily\ncurl 'http://localhost:8764/provider-dubbo-sample/api/add?a=1\u0026b=2'\ncurl -X POST http://localhost:8764/provider-dubbo-sample/api/echo -H \"Content-Type: application/json\" -d '{\"message\":\"hi\"}'\ncurl 'http://localhost:8764/provider-dubbo-sample/api/greet/lily?lang=zh'\n```\n\n### sentinel gateway 演示\n`cloud-gateway-sample`集成了sentinel，并采用nacos配置规则，规则示例如下 \u003cbr\u003e\ngroup-id: SENTINEL_GROUP \u003cbr\u003e\ndata-id: cloud.sample.gateway.gw-api-group\n```json\n[\n  {\n    \"apiName\": \"consumer_reactive_api\",\n    \"predicateItems\": [\n      {\n        \"pattern\": \"/consumer-reactive-sample/**\",\n        \"matchStrategy\": 1\n      }\n    ]\n  },\n  {\n    \"apiName\": \"consumer_api\",\n    \"predicateItems\": [\n      {\n        \"pattern\": \"/consumer-sample/**\",\n        \"matchStrategy\": 1\n      }\n    ]\n  }\n]\n```\ngroup-id: SENTINEL_GROUP \u003cbr\u003e\ndata-id: cloud.sample.gateway.gw-flow\n```json\n[\n  {\n    \"resource\": \"consumer_reactive_api\",\n    \"resourceMode\": 1,\n    \"count\": 10\n  },\n  {\n    \"resource\": \"consumer_api\",\n    \"resourceMode\": 1,\n    \"count\": 5\n  },\n  {\n    \"resource\": \"consumer-reactive-sample\",\n    \"resourceMode\": 0,\n    \"count\": 20\n  }\n]\n```\n演示：在浏览器快速刷新访问几次如下接口\n```text\nhttp://localhost:8764/consumer-sample/hi?name=hongxi\n```\n触发限流时返回\n```json\n{\"code\":444,\"msg\":\"Sentinel gateway block\"}\n```\n\n### Stream 演示\n#### Run RocketMQ locally\ndownload [rocketmq-all-5.5.0-bin-release.zip](https://dist.apache.org/repos/dist/release/rocketmq/5.5.0/rocketmq-all-5.5.0-bin-release.zip)\n```shell\nbin/mqnamesrv\nbin/mqbroker -n localhost:9876 --enable-proxy\n```\n\n#### Create Topic and Consumer Group\n```shell\nbin/mqadmin updateTopic -n localhost:9876 -c DefaultCluster -t stream-demo-topic -a +message.type=NORMAL\nbin/mqadmin updateSubGroup -n localhost:9876 -c DefaultCluster -g stream-demo-consumer-group\n```\n\n#### Run Demo\n启动`stream`，观察日志\n\n### 分支说明\n- branch springboot3: 基于 Spring Boot 3.5.0+ 的示例\n- branch eureka: 初始版本，使用eureka作为注册中心\n\n\u0026copy; [hongxi.org](http://hongxi.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavahongxi%2Fspring-cloud-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavahongxi%2Fspring-cloud-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavahongxi%2Fspring-cloud-samples/lists"}