{"id":15024519,"url":"https://github.com/ttulka/spring-boot-configuration-properties-store","last_synced_at":"2026-01-05T03:44:43.810Z","repository":{"id":57729195,"uuid":"284237821","full_name":"ttulka/spring-boot-configuration-properties-store","owner":"ttulka","description":"Mutable persistent configuration properties that survive an application restart.","archived":false,"fork":false,"pushed_at":"2022-06-08T06:28:10.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-27T09:44:25.664Z","etag":null,"topics":["config-store","configuration","configuration-management","configuration-storage","spring-boot"],"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/ttulka.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":"2020-08-01T10:25:56.000Z","updated_at":"2022-04-22T21:13:09.000Z","dependencies_parsed_at":"2022-09-10T23:41:41.739Z","dependency_job_id":null,"html_url":"https://github.com/ttulka/spring-boot-configuration-properties-store","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fspring-boot-configuration-properties-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fspring-boot-configuration-properties-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fspring-boot-configuration-properties-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fspring-boot-configuration-properties-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttulka","download_url":"https://codeload.github.com/ttulka/spring-boot-configuration-properties-store/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937832,"owners_count":20535127,"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-store","configuration","configuration-management","configuration-storage","spring-boot"],"created_at":"2024-09-24T20:00:28.879Z","updated_at":"2026-01-05T03:44:43.772Z","avatar_url":"https://github.com/ttulka.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Configuration Properties Store for Spring Boot\n\nMutable persistent configuration properties that survive an application restart.\n\nExtendable store types. JDBC store as default. \n\n## Usage\n\n### Maven dependency\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.ttulka.spring.boot.configstore\u003c/groupId\u003e\n    \u003cartifactId\u003econfiguration-properties-store-jdbc-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Application setting\n\nThe application environment must contain data source configuration properties.\n\nFor example in `application.yml`: \n\n```yaml\nspring:\n  datasource:\n    url: jdbc:h2:./mydb\n    driverClassName: org.h2.Driver\n    username: sa\n    password:\n```\n\n### Update a configuration property\n\n```java\n@Autowired\nConfigurationStore configStore;\n...\nconfigStore.update(\"my-property\", \"value123\");\n```\n\nWill be persisted and loaded at the next application startup:\n\n```java\n@ConfigurationProperties\n@Getter\n@Setter\npublic class SampleProperties {\n\n    private String myProperty;\n}\n```\n\n#### Asynchronous update\n\nProcessing of the property update is done via application events, these are synchronous by default.\n\nYou can enable running async mode by annotation one of your configurations with `@EnableAsync`.\n\n## Settings\n\n- `spring.configstore.prefix` (default: `null`) \n  - Prefix added to a property name: `\u003cprefix\u003e.\u003cpropName\u003e`.\n  - When `null`, no prefix is added.\n  - String value.\n- `spring.configstore.source.last` (default: `false`)\n  - The property source is added as last, otherwise as first. \n  - Boolean value.\n- `spring.configstore.jdbc.enabled` (default: `true`)\n  - JDBC-based store is enabled/disabled.\n  - Boolean value. \n- `spring.configstore.jdbc.schema` (default: `null`)\n  - Schema for the property store database table.\n  - When not set (`null`) will use the default schema.\n  - String value.\n- `spring.configstore.jdbc.table` (default: `configstore_properties`)\n  - Database table name for the  property store.\n  - When a schema set will result into `\u003cschema\u003e.\u003ctable\u003e`.\n  - String value.\n  \n### Custom converters\n\nAs well as for configuration properties, custom converters can be added. To each custom converter there must be an inverted converter:\n\n```java\n@Component\n@ConfigurationPropertiesBinding\nclass EmployeeConverter implements Converter\u003cString, Employee\u003e {\n \n    @Override\n    public Employee convert(String from) {\n        String[] data = from.split(\",\");\n        return new Employee(data[0], Double.parseDouble(data[1]));\n    }\n}\n\n@Component\n@ConfigurationPropertiesBinding\nclass EmployeeInvertedConverter implements Converter\u003cEmployee, String\u003e {\n \n    @Override\n    public String convert(Employee from) {\n        return from.firstName() + \",\" + from.lastName();\n    }\n}\n```\n\nThen, the class could be used in configuration properties as well as in configuration store:\n\n```java\n@ConfigurationProperties\npublic class SampleProperties {\n\n    private Employee employee;\n    ...\n}\n...\nconfigStore.update(\"employee\", new Employee(\"Homer\", \"Simpson\"));\n```\n  \n## Customizing\n\nThere are several interfaces to be implemented for customizing the store.\n\n- `ConfigurationPropertiesStore`\n  - The default implementation publishes an event.\n  - The entry point, should be autowired in the application.\n  \n      ```java\n      @Autowired\n      ConfigurationStore configStore;\n    \n      configStore.update(\"my-prop\", 123);\n      ```\n    \n- `ConfigurationStoreEventPublisher`\n  - The default implementation uses Spring's `ApplicationEventPublisher`.\n  - Could be extended together with an event handling that calls `ConfigurationStoreEventListener`:\n    \n    ```java\n    @Bean\n    ConfigurationStoreEventPublisher applicationConfigurationStoreEventPublisher(\n            ApplicationEventPublisher publisher) {\n        return publisher::publishEvent;\n    }\n    ```\n    \n    And:\n      \n    ```java\n    @Component\n    @RequiredArgsConstructor\n    class ConfigurationPropertyUpdatedEventListener {\n\n        private final ConfigurationStoreEventListener configurationStoreEventListener;\n\n        @EventListener\n        void handleEvent(ConfigurationPropertyUpdated event) {\n            configurationStoreEventListener.on(event);\n        }\n    }\n    ```\n    \n## Building\n\n```\nmvn clean install\n```\n    \n## Extending \n\nSo far there is the following implementation:\n\n- JDBC\n    - `com.ttulka.spring.boot.configstore:configuration-properties-store-jdbc-spring-boot-starter`\n\nThen implementing a new extension, at least `ConfigurationStoreEventListener` must be implemented.\n\nNext, a new implementation of `ConfigurationStorePostProcessor` is needed to load properties into the environment. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fspring-boot-configuration-properties-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttulka%2Fspring-boot-configuration-properties-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fspring-boot-configuration-properties-store/lists"}