App Configuration with a Spring Config Server

This tutorial takes you through setting up a .NET Core application that gets configuration values from a Spring Config Server.
First, create a Github repository to hold config values.
  1. Navigate to Github and either login or create a new account
  2. Create and initialize a new repository, named Spring-Config-Demo
  3. Once created note the url of the new repo
Next, add a config file to the repository.
  1. Create a new file in the repo named my-values.yml
  2. Add the following to the file
    Value1: some-val
    Value2: another-val
  3. Commit the new file to the repo
Then, start a config server instance. Depending on your hosting platform this is done in several ways.
Next, create a .NET Core WebAPI that retrieves values from the Spring Config instance
  1. Create a new ASP.NET Core WebAPI app with the Steeltoe Initializr
    • SteeltoeVersion: 2.4 for the latest stable
    • Project Metadata:
      Name: Spring_Config_Example
      Target Framework: netcoreapp3.1 is the latest stable
    • Dependencies: Config Server
    • Click Generate Project to download a zip containing the new project
  2. Extract the zipped project and open in your IDE of choice (we use Visual Studio)
  3. Set the instance address and name in appsettings.json
    For the application to find its values in the git repo, the spring:application:name and the yaml file name must match. In this example my-values matched.
  4. Run the application
  5. Once the app loads in the browser you will see the two values output.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙