{"id":24021161,"url":"https://github.com/zipcodecore/maven.spring-config-client","last_synced_at":"2025-10-04T02:32:13.680Z","repository":{"id":147838028,"uuid":"146234709","full_name":"ZipCodeCore/Maven.Spring-Config-Client","owner":"ZipCodeCore","description":"MesoLab dealing with Spring Cloud Configuration","archived":false,"fork":false,"pushed_at":"2018-08-27T20:00:30.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-08T12:41:24.684Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ZipCodeCore.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,"publiccode":null,"codemeta":null}},"created_at":"2018-08-27T02:04:26.000Z","updated_at":"2022-02-03T18:57:45.000Z","dependencies_parsed_at":"2023-04-06T06:47:43.318Z","dependency_job_id":null,"html_url":"https://github.com/ZipCodeCore/Maven.Spring-Config-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/ZipCodeCore%2FMaven.Spring-Config-Client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FMaven.Spring-Config-Client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FMaven.Spring-Config-Client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FMaven.Spring-Config-Client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/Maven.Spring-Config-Client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766672,"owners_count":19854114,"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":"2025-01-08T12:39:32.757Z","updated_at":"2025-10-04T02:32:08.633Z","avatar_url":"https://github.com/ZipCodeCore.png","language":"Java","readme":"## Creating A Spring Config Server\n\n* **Objective** - to implement and consume a Spring Config Server, providing a HTTP resource-based API for external configuration. \n\n* **Purpose** - to demonstrate\n    * ``@EnableConfigServer``\n    * Configuring a Config Server through ``application.properties``.\n    * Consuming a config server through ``bootstrap.properties``\n    * ``@EnableConfigurationProperties``\n    * Using ``@ConfigurationProperties`` to map configuration properties to POJOs.\n\t\n### Part 1.0 - Create A Spring Config Server Class\n\t\n* Navigate to \u003ca href=\"start.spring.io\"\u003estart.spring.io\u003c/a\u003e to initialize a new project.\n\n* Choose your group and artifact, then search for **Config Server** under dependencies and add it to your project.\n\n* After opening up your project annotate the main application class with ``@EnableConfigServer``.\n\n* In the ``application.properties`` file, set your port to ``8888`` via the appropriate property. \u003ca href=\"https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#_spring_cloud_config_server\"\u003eHint\u003c/a\u003e\n\n* In the ``application.properties`` file, set the uri of the configuration repository via the appropriate property. \u003ca href=\"https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#_spring_cloud_config_server\"\u003eHint\u003c/a\u003e\n    * The configuration repository is located at https://github.com/Zipcoder/CR-MesoLab-Spring-Config-Repo\n    \n* Test that your config server is running by starting the application and navigating to ``localhost:8888\\bakery-service\\default``. This endpoint exposes all the properties available to a service that exposes itself as \"bakery-service\". \n\n### Part 2.0 - Consume A Config Server as a Config Client\n\n* Open up the project contained in this repo via the pom.xml\n\n* Add the following to the pom.xml file\n\n```\n\u003cdependency\u003e\n   \u003cgroupId\u003eorg.springframework.cloud\u003c/groupId\u003e\n   \u003cartifactId\u003espring-cloud-starter-config\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n* Create a ``bootstrap.properties`` file in src/main/java/resources.\n\n* Inside the ``bootstrap.properties`` file, name your project \"bakery-service\" via the appropriate property. \u003ca href=\"https://spring.io/guides/gs/centralized-configuration/#_reading_configuration_from_the_config_server_using_the_config_client\"\u003eHint\u003c/a\u003e\n\n* Inside the ``bootstrap.properties`` file, point your server to the uri where your config server is located. \u003ca href=\"https://spring.io/guides/gs/centralized-configuration/#_reading_configuration_from_the_config_server_using_the_config_client\"\u003eHint\u003c/a\u003e\n\n* Start your application. To test if your client is successfully pointing to a config server, navigate to ``localhost:8080/actuator/env/properties``. Find the the \"configService\" key in the json. If the value points to the correct git repository uri, you're on the right track.\n\n### Part 3.0 Mapping Config Properties to POJOs\n\n* Navigate to the configuration properties git uri and click on ``bakery-service.configuration``. Observe the naming convention of the listed properties. \n\n* Navigate back to your bakery-service application in IntelliJ and annotate the main application class with ``@EnableConfigurationProperties``\n\n* Navigate to the ``Bakery`` class in the Models folder. Bind the ``owner``, ``name``, and ``description`` fields to ``configuration.bakery.owner``, ``configuration.bakery.name``, and ``configuration.bakery.description``, respectively, using ``@ConfigurationProperties``. Do not use ``@Value``.\n\n* Navigate to the ``BakeryController`` class in Controllers. Notice that there is a ``/bakery`` endpoint that exposes our bakery bean. Visit that endpoint and verify that the owner, name, and description fields have been bound to the appropriate properties.\n\n### Part 3.1 Identifying our Application as a different service\n\n* Navigate to your ``bootstrap.properties`` file. Change the name of your application from ``bakery-service`` to ``leons-bakery-service``. Navigate back to ``localhost:8080/bakery`` and observe the difference. What is happening?\n\n* Navigate to your ``bootstrap.properties`` file. Change the name of your application from ``bakery-service`` to ``wilhems-bakery-service``. Navigate back to ``localhost:8080/bakery`` and observe the difference. What is happening?\n\n* Navigate to your ``bootstrap.properties`` file. Change the name of your application from ``bakery-service`` to ``dominiques-bakery-service``. Navigate back to ``localhost:8080/bakery`` and observe the difference. What is happening?\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fmaven.spring-config-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fmaven.spring-config-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fmaven.spring-config-client/lists"}