{"id":13527191,"url":"https://github.com/Netflix/archaius","last_synced_at":"2025-04-01T09:31:14.345Z","repository":{"id":3253437,"uuid":"4291387","full_name":"Netflix/archaius","owner":"Netflix","description":"Library for configuration management API","archived":false,"fork":false,"pushed_at":"2025-03-20T18:39:04.000Z","size":4001,"stargazers_count":2478,"open_issues_count":36,"forks_count":484,"subscribers_count":556,"default_branch":"2.x","last_synced_at":"2025-03-25T16:14:30.555Z","etag":null,"topics":[],"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/Netflix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2012-05-11T00:07:05.000Z","updated_at":"2025-03-20T18:32:47.000Z","dependencies_parsed_at":"2023-02-18T12:19:35.672Z","dependency_job_id":"7dcf58ea-d9e4-47d7-add6-3d183e1d6bfe","html_url":"https://github.com/Netflix/archaius","commit_stats":{"total_commits":461,"total_committers":32,"mean_commits":14.40625,"dds":0.631236442516269,"last_synced_commit":"70da5b16686cc560f900ab142bf567ce17d7909e"},"previous_names":[],"tags_count":170,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Farchaius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Farchaius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Farchaius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Farchaius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netflix","download_url":"https://codeload.github.com/Netflix/archaius/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246616042,"owners_count":20806044,"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":[],"created_at":"2024-08-01T06:01:42.899Z","updated_at":"2025-04-01T09:31:13.041Z","avatar_url":"https://github.com/Netflix.png","language":"Java","readme":"Archaius is a configuration library for accessing a mixture of static as well\nas dynamic configurations as a single configuration unit. \n\nThere are two key concepts to note:\n\n* **Properties** that can be read by your code.\n* **Configurations** that organize properties into objects you can bootstrap your application with.\n\n## Features\n* Lock-free property reads.\n* Dependency Injection (i.e., Guice) friendly so you don't have to rely on static code execution.\n\n## 2.x Changes\n* **Not backwards compatible with 1.x.**\n* Clean separation of API and backing configurations (i.e. commons-configuration, \ntypesafe-configuration, etc).\n* Minimal external dependencies.\n* Improved bootstrapping process that doesn't rely on class loading.\n\n## Getting Started\n\nArchaius provides a set of specialized configuration classes that may be combined\nusing `com.netflix.archaius.api.config.CompositeConfig` into a specific override structure.  \nCheck out `com.netflix.archaius.ProxyFactoryTest` (under `archaius2-core/test/java/`) for an \nexample on how to bootstrap a config and access dynamic properties from it.\n\n## Accessing configuration\n\nAll `com.netflix.archaius.api.Config` (under `archaius2-api/`) derived classes provide access to \ntheir underlying configuration via the numerous `getString()`, `getInt()`, `getBoolean()` methods.  \nIn addition to basic primitives and collections `Config` will allow parsing to any type that has a \nconstructor that takes a single String argument or a `static valueOf(String.class)` method.  \n\n## Replacements\n\nArchaius supports standard variable replacement syntax such as `${other.property.name}`.   \n\n## Configuration loaders\n\nArchaius has a default built in loader for `.properties` files but can also be extended with custom\nproperty specifications such as HOCON.  In addition multiple contextual overrides for a single \nconfiguration resource name may be derived using a `com.netflix.archaius.api.CascadeStrategy`.\nThe strategy may also specify replacements from already loaded configurations (such as System and\n Environment properties).\n\n## Dynamic Properties\n\nOne of the core differentiators between Archaius and other configuration libraries\nis its support for dynamically changing configuration.  Traditionally applications \nrequire a restart whenever configuration changes.  This can result in unnecessary \nservice interruption during minor configuration changes, such as timeout values.  Through\nArchaius, code can have direct access to the most recent configuration without the need to \nrestart.  In addition, code can react to configuration changes by registering a change\nhandler.  \n\nDynamic configuration support is split into the configuration loading and property\nvalue resolution.\n\n### Configuration loading\n\nWhen adding a DynamicConfig derived configuration CompositeConfig will automatically register for\nconfiguration change notifications and incorporate new values into the main configuration.  \nArchaius provides a base PollingDynamicConfig for use with configuration sources that are\npolled frequently to refresh the entire configuration snapshot.  Implement Config \ndirectly for fine grained configuration sources, such as ZooKeeper, which support updates \nat the individual property granularity.\n\n```java\nconfig.addConfig(new PollingDynamicConfig(\n            \"REMOTE\", \n            new URLConfigReader(\"http://remoteconfigservice/snapshot\"), \n            new FixedPollingStrategy(30, TimeUnit.SECONDS)) \n```\n\n### Property access\n\nUse the Property API for optimized access to any property that is expected to be updated at\nruntime.  Access to dynamic configuration follows two access patterns.  The first (and most common)\nis to get the most recent value directly from a Property object.  \nProperty optimizes caching of the resolved property value (from the hierarchy) and is much more \nefficient than calling the Config object for frequently accessed properties.  \nThe second, and more advanced, access pattern is to react to property value changes via a \n`com.netflix.archaius.api.PropertyListener`.  \n\nTo create a fast property factory using any Config as the source\n```java\nDefaultPropertyFactory factory = DefaultPropertyFactory.from(config);\n```\n\nTo create a `com.netflix.archaius.api.Property` object\n\n```java\nProperty\u003cInteger\u003e timeout = factory.getProperty(\"server.timeout\").asInteger(DEFAULT_TIMEOUT_VALUE);\n```\n\nTo access the cached property value\n```java\nThread.sleep(timeout.get());\n```\n\nTo react to property change notification\n\n```java\nProperty\u003cInteger\u003e timeout = factory\n    .getProperty(\"server.timeout\")\n    .asInteger() \n    .addListener(new PropertyListener\u003cInteger\u003e() {\n        public void onChange(Integer value) {\n            socket.setReadTimeout(value);\n        }\n        \n        public void onError(Throwable error) {\n        }\n    });\n```\n\n\n\n","funding_links":[],"categories":["Java","others","V. Tools for developing","常用框架\\\u0026第三方库","Open Source Repos"],"sub_categories":["2. Deploy, config and build","Miscellaneous Repos"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Farchaius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetflix%2Farchaius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Farchaius/lists"}