{"id":18793992,"url":"https://github.com/houkx/disconf-client","last_synced_at":"2025-09-12T07:33:23.679Z","repository":{"id":87641221,"uuid":"196352001","full_name":"houkx/disconf-client","owner":"houkx","description":"简洁而强大的spring配置工具","archived":false,"fork":false,"pushed_at":"2022-06-29T19:42:03.000Z","size":31,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-27T06:03:47.519Z","etag":null,"topics":["config","disconf","spring"],"latest_commit_sha":null,"homepage":null,"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/houkx.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}},"created_at":"2019-07-11T08:24:33.000Z","updated_at":"2024-09-10T02:52:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a4abc25-57f9-4f96-b9b5-beefc53328a2","html_url":"https://github.com/houkx/disconf-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houkx%2Fdisconf-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houkx%2Fdisconf-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houkx%2Fdisconf-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houkx%2Fdisconf-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/houkx","download_url":"https://codeload.github.com/houkx/disconf-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248728178,"owners_count":21152175,"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","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":["config","disconf","spring"],"created_at":"2024-11-07T21:27:42.916Z","updated_at":"2025-04-13T14:32:26.372Z","avatar_url":"https://github.com/houkx.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# disconf-client\n简洁而强大的spring配置工具\n*  代码量大约只有原作者的1/10, 没有繁琐的二次扫描啥的.\n*  解决了几个bug, 比如debug=true时断线就不重连,莫名其名的断线等.\n*  支持json和 * 通配符配置\n*  配置更简洁, 业务代码无侵入, 只需要关注原生spring @Value注解\n*  配置变更后自动修改@Value注解的字段,和自动调用@Value注解的setter方法\n*  即使不使用disconf也能使用框架的接口主动修改配置\n\n``` properties\n# settings.properties\napp.title=someGame\napp.tags=[\"play\",\"war\"]\napp.user.hobby.lilei=fishing\napp.user.hobby.HanMeimei=reading\n```\n-----------------------------------------------------------------------\n```xml\n \u003c!-- disconf.xml --\u003e\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cbeans xmlns=\"http://www.springframework.org/schema/beans\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\"\u003e\n\n    \u003c!-- config center config --\u003e\n    \u003cbean id=\"disConfPropertyConfigurer\" class=\"io.disconf.client.DisConfPropertyConfigurer\"\u003e\n        \u003cconstructor-arg index=\"0\" value=\"myApp\"/\u003e \u003c!--  appName --\u003e\n        \u003cconstructor-arg index=\"1\"\u003e\n            \u003c!--  所有配置项 --\u003e\n            \u003carray\u003e\n                \u003cvalue\u003esettings.properties\u003c/value\u003e\n                \u003cvalue\u003elog4j2.xml\u003c/value\u003e\n            \u003c/array\u003e\n        \u003c/constructor-arg\u003e\n    \u003c/bean\u003e\n\n\u003c/beans\u003e\n```\n---------------------------------------------------------------------------------------\n``` xml\n \u003c!-- app-test.xml --\u003e\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cbeans xmlns=\"http://www.springframework.org/schema/beans\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xmlns:context=\"http://www.springframework.org/schema/context\"\n       xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd\"\u003e\n\n    \u003ccontext:component-scan base-package=\"test.spring.base\"/\u003e\n\u003c/beans\u003e\n```\n---------------------------------------ConfigTest_.java------------------------------------------------\n```java\npackage test.spring;\n\nimport io.disconf.client.DisConfPropertyConfigurer;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.test.context.ContextConfiguration;\nimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\nimport test.spring.base.Configs;\n\nimport java.util.Properties;\n@RunWith(SpringJUnit4ClassRunner.class)\n@ContextConfiguration({\"classpath:disconf.xml\", \"classpath:app-test.xml\"})\npublic class ConfigTest_ {\n\n    @Autowired\n    Configs configs;\n\n    @Autowired\n    DisConfPropertyConfigurer disConfPropertyConfigurer;\n\n    @Test\n    public void test_config() {\n        System.out.println(\"configs = \" + configs);\n\n        Properties properties = new Properties();\n        properties.put(\"app.title\", \"myApp\");\n        properties.put(\"app.title\", \"myApp\");\n        properties.put(\"app.user.hobby.NewResetUser\", \"WriteBug\");\n        // when use disconf, this method is auto invoke when Config Changed\n        // 当使用disconf时,这个方法是自动调用的;  由于第一个参数传的是null, 所以这里是重置\n        disConfPropertyConfigurer.changeBeanProperties(null, properties);\n\n        System.out.println(\"** After Refresh:\\nconfigs = \" + configs);\n    }\n\n}\n```\n-------------------------------------Configs.java--------------------------------------------------\n``` java\npackage test.spring.base;\n\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframework.stereotype.Component;\n\nimport java.util.Arrays;\nimport java.util.Map;\n\n@Component\npublic class Configs {\n    @Value(\"${app.tags:[]}\")\n    public String[] tags;\n    public String title;\n\n    public Map\u003cString,String\u003e userHobby;\n\n    @Value(\"${app.title}\")\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n    @Value(\"${app.user.hobby.*}\")\n    public void setUserHobby(Map\u003cString, String\u003e userHobby) {\n        this.userHobby = userHobby;\n    }\n\n    @Override\n    public String toString() {\n        final StringBuilder sb = new StringBuilder(\"Configs{\");\n        sb.append(\"tags=\").append(Arrays.toString(tags));\n        sb.append(\", title='\").append(title).append('\\'');\n        sb.append(\", userHobby=\").append(userHobby);\n        sb.append('}');\n        return sb.toString();\n    }\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoukx%2Fdisconf-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoukx%2Fdisconf-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoukx%2Fdisconf-client/lists"}