{"id":37455436,"url":"https://github.com/xjzrc/disconf-spring-boot-starter","last_synced_at":"2026-01-16T07:00:07.826Z","repository":{"id":228325321,"uuid":"121834630","full_name":"xjzrc/disconf-spring-boot-starter","owner":"xjzrc","description":"disconf-spring-boot-starter 让你可以使用spring-boot的方式开发依赖disconf的程序  只需要关心disconfi的配置文件和配置项，省略了编写xml的麻烦","archived":false,"fork":false,"pushed_at":"2018-04-03T02:30:51.000Z","size":31,"stargazers_count":42,"open_issues_count":2,"forks_count":17,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-18T08:33:18.180Z","etag":null,"topics":["disconf","spring","spring-boot","spring-boot-starter"],"latest_commit_sha":null,"homepage":"","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/xjzrc.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}},"created_at":"2018-02-17T06:59:54.000Z","updated_at":"2024-03-18T08:33:28.078Z","dependencies_parsed_at":"2024-03-18T08:33:27.636Z","dependency_job_id":"154e213c-9fbc-48fd-a76c-ad33c55d2353","html_url":"https://github.com/xjzrc/disconf-spring-boot-starter","commit_stats":null,"previous_names":["xjzrc/disconf-spring-boot-starter"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xjzrc/disconf-spring-boot-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xjzrc%2Fdisconf-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xjzrc%2Fdisconf-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xjzrc%2Fdisconf-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xjzrc%2Fdisconf-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xjzrc","download_url":"https://codeload.github.com/xjzrc/disconf-spring-boot-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xjzrc%2Fdisconf-spring-boot-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["disconf","spring","spring-boot","spring-boot-starter"],"created_at":"2026-01-16T07:00:07.349Z","updated_at":"2026-01-16T07:00:07.679Z","avatar_url":"https://github.com/xjzrc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":" disconf-spring-boot-starter\n===================================\n disconf-spring-boot-starter\n让你可以使用spring-boot的方式开发依赖disconf的程序\n\n只需要关心disconfi的配置文件和配置项，省略了编写xml的麻烦\n*****\n\n### 使用步骤(示例:[「spring-boot-starter-demo」](https://github.com/xjzrc/spring-boot-starter-demo))\n\n* 在`spring boot`项目的`pom.xml`中添加以下依赖：\n\n根据实际情况依赖最新版本（当前最新版本1.0.1）\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.xjzrc.spring.boot\u003c/groupId\u003e\n    \u003cartifactId\u003edisconf-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e${lasted.release.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\u003cbr/\u003e\n* 在application.yml添加disconf的相关配置信息\u003cbr/\u003e\n特别注意：配置属性名规则只支持如下样例模式，否则无法解析。如：scan-package不能写成scanPackage\n\u003cbr/\u003e具体样例配置如下:\n\n```yml\nspring:\n  aop:\n    #使你的项目支持 cglib的aop\n    proxy-target-class: true\n  disconf:\n    #disconf包扫描路径\n    scan-package: com.zen.spring.boot.demo.disconf\n    #不需要自动reload的配置文件\n    un-reload-files: myserver.properties\n    #需要自动reload的配置文件\n    reload-files: autoconfig.properties,autoconfig2.properties,myserver_slave.properties,testJson.json,testXml2.xml\n    #是否使用远程配置文件，true(默认)会从远程获取配置 false则直接获取本地配置\n    enable-remote-conf: true\n    #配置服务器的 HOST(必填)，用逗号分隔  127.0.0.1:8000,127.0.0.1:8000\n    conf-server-host: 127.0.0.1\n    #APP 请采用 产品线_服务名 格式\n    app: disconf-demo\n    #环境\n    env: rd\n    #版本, 请采用 X_X_X_X 格式,注意要用单引号，不然Springboot将会解析成1000\n    version: '1_0_0_0'\n    #忽略哪些分布式配置，用逗号分隔\n    ignore:\n    #调试模式。调试模式下，ZK超时或断开连接后不会重新连接（常用于client单步debug）。非调试模式下，ZK超时或断开连接会自动重新连接。\n    debug: false\n    #获取远程配置 重试次数，默认是3次\n    conf-server-url-retry-times: 1\n    #获取远程配置 重试时休眠时间，默认是5秒\n    conf-server-url-retry-sleep-seconds: 1\n    #用户定义的下载文件夹, 远程文件下载后会放在这里。注意，此文件夹必须有有权限，否则无法下载到这里\n    user-define-download-dir: /app/spring-boot/disconf/disconf-spring-boot-starter-demo\n    #下载的文件会被迁移到classpath根路径下(默认是false)\n    enable-local-download-dir-in-class-path: false\n```\n\n\u003cbr/\u003e\n* 不需要动态推送配置写法\u003cbr/\u003e\n  * 添加disconf配置文件名到application.properties中的disconf.files配置项，多个文件用逗号分隔\n  \n  * 直接用@Value注释引用变量\n  \n  ```java\n      @Value(\"${database.driverClassName}\")\n      private String driverClassName;\n  ```\n \n* 需要动态推送配置写法\u003cbr/\u003e\n\n```java\n     @Service\n     @Scope(\"singleton\")\n     @DisconfFile(filename = \"app-conf.properties\")\n     public class AppConfig {\n         /**\n          * 配置项属性\n          */\n         private String property;\n         \n          @DisconfFileItem(name = \"config\", associateField = \"property\")\n           public void setProperty(String property) {\n               this.property = property;\n           }\n     }\n  ```\n    \n* springboot原有starter中需要依赖disconf配置怎么办?比如redis等 \n  * 直接在disconf上面配置springboot starter中要求的配置项即可\n  ```java\n  原理\n  应用启动时，disconf starter\n  从disconf服务器上拉取配置文件，下载到本地，并且解析文件中的变量注入到spring环境Environment中, 供依赖的springboot starter使用\n  springboot在初始化starter中的配置类时，会循环读取Environment中包含的各个properties，有符合配置类的变量，就注入到相应配置类\n  ```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjzrc%2Fdisconf-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxjzrc%2Fdisconf-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjzrc%2Fdisconf-spring-boot-starter/lists"}