{"id":20635716,"url":"https://github.com/yyvess/guice-configuration","last_synced_at":"2025-04-15T21:25:21.858Z","repository":{"id":3105610,"uuid":"48452205","full_name":"yyvess/Guice-configuration","owner":"yyvess","description":"Guice configuration module allows inject values from files as JSON, HOCON and Properties format","archived":false,"fork":false,"pushed_at":"2023-12-05T22:39:18.000Z","size":100,"stargazers_count":34,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T01:34:12.219Z","etag":null,"topics":["guice","guice-configuration","json","yaml"],"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/yyvess.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}},"created_at":"2015-12-22T20:21:21.000Z","updated_at":"2024-08-05T16:44:56.000Z","dependencies_parsed_at":"2022-08-04T12:45:32.096Z","dependency_job_id":null,"html_url":"https://github.com/yyvess/Guice-configuration","commit_stats":null,"previous_names":["yyvess/gconf"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyvess%2FGuice-configuration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyvess%2FGuice-configuration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyvess%2FGuice-configuration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyvess%2FGuice-configuration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yyvess","download_url":"https://codeload.github.com/yyvess/Guice-configuration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249155737,"owners_count":21221651,"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":["guice","guice-configuration","json","yaml"],"created_at":"2024-11-16T15:06:48.276Z","updated_at":"2025-04-15T21:25:21.836Z","avatar_url":"https://github.com/yyvess.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Guice configuration module, JSON, HOCON \u0026 Properties formats supported, build on the top of Typesafe config\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.jmob/guice.conf/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/net.jmob/guice.conf?gav=true) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n[![Sonar Status](https://sonarcloud.io/api/project_badges/measure?project=net.jmob%3Aguice.conf\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=net.jmob%3Aguice.conf)  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=net.jmob%3Aguice.conf\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=net.jmob%3Aguice.conf)\n\n\nGuice configuration\n======\n\n## Overview\n\n- Guice injection \n- JSON, HOCON and Properties formats\n- Substitutions ${foo.bar}\n- Validation\n\n## Binary Releases\n\nYou can find published releases on Maven Central.\n\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003enet.jmob\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003eguice.conf\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003ev1.5.0\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\nOptionally, to active validation, you must import a validator like Hibernate validator\n\t\t\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.hibernate.validator\u003c/groupId\u003e\n            \u003cartifactId\u003ehibernate-validator-cdi\u003c/artifactId\u003e\n            \u003cversion\u003e6.2.0.Final\u003c/version\u003e\n        \u003c/dependency\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.glassfish\u003c/groupId\u003e\n            \u003cartifactId\u003ejavax.el\u003c/artifactId\u003e\n            \u003cversion\u003e3.0.0\u003c/version\u003e\n        \u003c/dependency\u003e\n\nLink for direct download if you don't use a dependency manager:\n\n - https://mvnrepository.com/artifact/net.jmob/guice.conf\n \n \n## Quickstart\n\nA configuration file `app.json` :\n\n```javascript\n{\n  \"port\": 8080,\n  \"complexEntries\": {\n    \"hostname\": \"www.github.com\",\n    \"aMap\": {\n      \"key1\": \"value1\",\n      \"key2\": \"value2\"\n    },\n    \"aList\": [\n      \"value1\",\n      \"value2\"\n    ]\n  }\n}\n```\n\nAn interface where inject your structured configuration\n\n```java  \n   public interface MyServiceConfiguration {\n\n      @Length(min = 5)\n      String getHostname();\n    \n      Map\u003cString, String\u003e getAMap();\n    \n      List\u003cString\u003e getAList();\n   }\n```\n\nA service where configuration should be inject\n```java  \n    @BindConfig(value = \"app\", syntax = JSON)\n    public class Service {\n\n        @InjectConfig\n        private Optional\u003cInteger\u003e port;\n\n        @InjectConfig(\"complexEntries\")\n        private MyServiceConfiguration config;\n\n        public int getPort() {\n            return port.orElse(0);\n        }\n\n        public ServiceConfiguration getConfig() {\n            return config;\n        }\n    }\n```\n\n```java  \n    public class GuiceModule extends AbstractModule {\n        @Override\n        protected void configure() {\n            install(new ConfigurationModule());\n            requestInjection(Service.class);\n        }\n    }\n```\n\nConfiguration files are loaded of classpath by default\n\nA directory can be specified to load configuration outside of classpath\n\n```java  \n    public class GuiceModule extends AbstractModule {\n        @Override\n        protected void configure() {\n            install(new ConfigurationModule()\n                .fromPath(new File(\"/etc\")));\n            requestInjection(Service.class);\n        }\n    }\n```\n\n\nVariables on your configuration file can be substitued with environment variables.\n\nSubstitution should be active with the option 'resolve'\n\n```java  \n@BindConfig(value = \"config, resolve = true)\n```\n\n```javascript\n{\n  myconfig: ${my.environement.property}\n}\n```\n\n\nPlease find more examples on src/test/samples\n\n## Supported types\n\n- boolean, Boolean\n- String\n- int, Integer, double, Double\n- List\u003c?\u003e, Map\u003c?\u003e, with typed value support\n- Optional\u003c?\u003e\n- Any Interface, a proxy of this interface is injected\n\n## References\n\n- https://github.com/typesafehub/config\n- https://github.com/google/guice\n\n## License\n\nThe license is Apache 2.0, see LICENSE file.\n\nCopyright (c) 2015-2016, Yves Galante\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyvess%2Fguice-configuration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyyvess%2Fguice-configuration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyvess%2Fguice-configuration/lists"}