{"id":18559054,"url":"https://github.com/linux-china/spring-boot-dubbo","last_synced_at":"2025-10-27T15:08:02.717Z","repository":{"id":136596145,"uuid":"44529452","full_name":"linux-china/spring-boot-dubbo","owner":"linux-china","description":"Spring Boot with Dubbo support","archived":false,"fork":false,"pushed_at":"2018-07-18T22:05:54.000Z","size":167,"stargazers_count":280,"open_issues_count":4,"forks_count":156,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-10-13T00:09:32.105Z","etag":null,"topics":["dubbo","spring-boot"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linux-china.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2015-10-19T11:15:59.000Z","updated_at":"2025-08-13T11:14:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"a04663ff-707e-49f3-a91b-12cacc157d32","html_url":"https://github.com/linux-china/spring-boot-dubbo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linux-china/spring-boot-dubbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-dubbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-dubbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-dubbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-dubbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/spring-boot-dubbo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-dubbo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281287744,"owners_count":26475418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","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","spring-boot"],"created_at":"2024-11-06T21:41:56.401Z","updated_at":"2025-10-27T15:08:02.690Z","avatar_url":"https://github.com/linux-china.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Spring Boot With Dubbo\n===========================\n主要介绍如何在Spring Boot中整合Dubbo的使用.\n\n### 注意事项\n\n由于Dubbo的版本并不是特别活跃,加上和Spring Boot的jar包适配等问题,所以请使用最新的Dubbo 3.0.0-SNAPSHOT版本, 目前还有很多工作调整\n地址为: https://github.com/linux-china/dubbo3 \n\n### 注册中心(Registry)\n目前主要是支持Redis、ZooKeeper和Consul这三个注册中心，主要是这两个服务非常普遍，同时由于Docker的流行，启动这三者个服务也非常简单。\n\n##### Redis\n使用Redis注册中心，需要将在pom.xml中添加对应的redis客户端，代码如下：\n\n```xml\n     \u003cdependency\u003e\n         \u003cgroupId\u003eredis.clients\u003c/groupId\u003e\n         \u003cartifactId\u003ejedis\u003c/artifactId\u003e\n     \u003c/dependency\u003e\n```\n\n对应的配置项为： spring.dubbo.registry = redis://localhost:6379\n\n#####  ZooKeeper\n使用ZooKeeper注册中心，需要在pom.xml中添加zookeeper需要的jar包，代码如下：\n\n```xml\n     \u003cdependency\u003e\n         \u003cgroupId\u003eorg.apache.curator\u003c/groupId\u003e\n         \u003cartifactId\u003ecurator-framework\u003c/artifactId\u003e\n         \u003cversion\u003e2.12.0\u003c/version\u003e\n     \u003c/dependency\u003e\n     \u003cdependency\u003e\n         \u003cgroupId\u003ecom.101tec\u003c/groupId\u003e\n         \u003cartifactId\u003ezkclient\u003c/artifactId\u003e\n         \u003cversion\u003e0.10\u003c/version\u003e\n     \u003c/dependency\u003e\n```\n\n对应的配置项为： spring.dubbo.registry = zookeeper://127.0.0.1:2181\n\n多个zookeeper的配置项为: spring.dubbo.registry = zookeeper://192.168.0.2:2181,192.168.0.3:2181\n\n### 如何测试\n\n* 首先使用IntelliJ IDEA导入项目\n* 调用docker-compose启动对应的注册中心: docker-compose up -d\n* 启动 SpringBootDubboServerApplication\n* 启动 SpringBootDubboClientApplication\n* 打开浏览器访问 http://localhost:2080\n\n### 在 Docker 中运行\n\n* 调用docker-compose启动对应的注册中心: docker-compose up -d\n* 编译工程 `mvn clean package -Dmaven.test.skip`\n* 将 server 打包成 docker image : `docker build -t dubbo-demo:latest spring-boot-dubbo-server`\n* 运行 server (注意修改环境变量) : `docker run --rm --name=dubbo-demo -p 20890:20880 -e EXPORT_PORT=20890 -e EXPORT_HOST=YOUR_HOST_HERE -e ZK_HOST=YOUR_HOST_HERE dubbo-demo`\n* 启动 SpringBootDubboClientApplication\n* 打开浏览器访问 http://localhost:2080\n\n### Spring DevTools注意事项\n由于Spring DevTools采用不一样的classloader的机制，所以会导致Dubbo Consumer Bean无法赋值到指定的@Component上，请使用以下规则：\n\n在 src/main/resources/META-INF/spring-devtools.properties 在添加以下代码进行DevTools的classloader屏蔽：\n```properties\nrestart.exclude.target-classes=/target/classes/\n```\n关于hotspot的模式下，相关Java代码调整后理解生效，可以考虑： http://dcevm.github.io/\n\n如果你的应用是纯Dubbo服务，没有涉及到Web页面，不建议你添加spring-devtools，如果添加了后，\n可以通过以下配置项关闭livereload服务，这样可以保证不必要的live reload服务启动。\n```properties\nspring.devtools.livereload.enabled=false\n```\n\n### todo\n\n* DubboConsumerBuilder: 快速构建Dubbo Consumer\n* zipkin: https://github.com/jessyZu/dubbo-zipkin-spring-starter\n\n### Spring Boot集成\n\n请参看 [spring-boot-starter-dubbo](https://github.com/linux-china/spring-boot-dubbo/tree/master/spring-boot-starter-dubbo) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fspring-boot-dubbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Fspring-boot-dubbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fspring-boot-dubbo/lists"}