
Explore spring cloud config server and the spring ecosystem, and see how this cloud configuration power supports microservices and cloud oriented systems. Gain lifetime access to updates and source code to accelerate your project.
Meet Mick Knutson, a software architect and instructor with decades of Java and Spring experience, including authoring the Java E6 cookbook, Spring Security third edition, and Spring Cloud training.
Explore the Spring Cloud Config ecosystem, build and configure a cloud config server, manage local git repositories with branching and tagging, and develop config clients with Spring Boot.
Review the tools and source code for distributed configuration with Spring Cloud Config, including config server, microservices client, and labs with releases, and cloud config repos, Maven and Gradle.
Understand how Spring Cloud builds on Spring Boot, including Spring IO, and complete a Spring Boot primer lab to practice starting an application.
Overview of what the Spring IO platform
Spring IO platform
Spring IO is a cohesive, versioned platform for building modern applications. It is a modular, enterprise-grade distribution that delivers a curated set of dependencies while keeping developers in full control of deploying only the parts they need. Spring IO is 100% open source, lean, and modular.
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
The "https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle" reference guide includes detailed descriptions of all the features, plus an extensive howto for common use cases.
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer's own laptop, bare metal data centres, and managed platforms such as AWS, Google Cloud and Cloud Foundry.
Learn to build a central configuration server with a local git repo, enable tagging and branching for multi-app configurations, and see how Spring Boot apps pull from the configuration via REST API.
Clarify how Spring, Spring Boot, and Spring Cloud relate, and how Spring Cloud Config server fits into microservices and the twelfth factor model, and preview moving into Spring Cloud Config.
Create a Maven and Gradle based Spring Boot application from the Spring Boot INITIALIZR web application.
The initial startup of the Spring Cloud config Server with the Maven wrapper, then the Gradle Wrapper, then testing the health of the server with the Actuator /health endpoint.
Import the Gradle project into a new Intellij IDEA project.
Students will perform some basic configuration on this Spring Boot application to ensure the server is ready to serve configuration requests once we have configuration to serve.
Finish the section by creating a Spring Boot application with Maven or Gradle and set up a Spring Cloud Config server, then add configuration for distributed configuration.
Create an empty local git repository
Create a YAML file, adding it to the repo and committing it to the Master branch.
Then create a GIT TAG for this specific commit. (v.1.1)
Then we will review pulling the configuration from the server.
Will talk about GIT Lifecycles related to pulling configuration.
We then pull configuration for v.1.0, and then v.1.1
Create a properties and YAML file for "dev" profile, adding them to the repo and committing it to the Master branch.
Then create a GIT TAG for this specific commit. (v.2.0)
Then we will review pulling the configuration from the server.
We then pull configuration for TAG v.2.0, then for "dev" profile.
Then we show how attempting to pull TAG v.2.0 with an invalid profile name.
Modify properties and YAML files for "default" and "dev" profile, committing it to the HOTFIX branch only.
Then create a GIT TAG for this specific commit. (v.3.0)
We will review pulling default configuration from the server, and then for "dev" profile.
We then pull configuration for branch HOTFIX and then for "dev" profile.
We then pull configuration for TAG v.3.0, then for "default" profile.
We then pull configuration for TAG v.3.0, then for "dev" profile.
Demonstrate pulling labeled configuration and profiles from a Spring Cloud Config Server, highlighting tag and label usage, profile precedence, and dev properties versus YAML across branches.
build a springboard client that pulls configurations from a spring cloud config server, verifies them via a rest endpoint, and explores property and yaml files, branches, and tags for versioning.
Create a spring cloud config client as a standalone spring boot app with spring initializr, adding dev tools, actuator, web, and config client dependencies, not a config server.
In this lecture, we will go over some basic configuration of the Client application that will be pulling configuration from our central server.
We will discuss the correlation of this local configuration to the reference of centralized configuration.
We then will discuss how to set the Profile, and TAG / LABEL for the client application.
Create a Spring rest controller to expose configuration from the config server, pulling name and message with @Value, including defaults, and provide a get endpoint that lists these properties.
Start the config server on port 8888, then run the microservices client to fetch default profile properties, including name and message.
Create a Spring Boot client to connect to a Spring Cloud Config Server and pull configuration. Set up two projects running simultaneously to practice client-server configuration management.
Create custom @ConfigurationProperties Object to encapsulate complex properties, and verify we can pull complex Configuration properties from the Config Server.
Delete the dev properties file, commit the change, and observe that YAML properties take precedence when pulling configuration from the master branch without a label, yielding version 2.1.
Pull configuration from a branch head or a tag label in spring cloud config, noting precedence of properties over YAML, and refresh by restarting the client.
Explore pulling configuration from non-master branches by creating a new Git branch and pulling from a specific branch to work with parallel configurations.
Demonstrates dynamically selecting the microservice configuration label via bootstrap and an environment variable (client_config_label), enabling versioned config tags or branches without hard coding.
Section Review
Explore fail-fast strategies for Spring Cloud Config when the server is unavailable, secure access with basic authentication, fine-tune client configuration, and enable refreshing configuration properties without restarting clients.
Adjust the fail-fast startup behavior by enabling and tuning retry logic with Spring Retry and AOP, configuring max attempts, initial interval, max interval, and multiplier to handle config server unavailability.
Enable basic authentication for the Spring Cloud Config server by adding the Spring Boot security starter and setting a fixed username and password in application.yml.
Configure the client to access the spring cloud config server with basic authentication by adding spring boot starter security and setting a username and password (user1, change me).
Enable client application retry support to attempt to connect to a remote resource multiple times before failing
Explore fail-fast behavior when the config server is unavailable and fine-tune settings in spring cloud config. Enable server basic authentication, authenticate the client, and refresh properties without restarting.
This course will lead intermediate to advanced SpringFramework and Spring Boot developers in creating a centralized Cloud Configuration server for use in cloud environments and MicroService architectures.
The course starts by creating a centralized Spring Cloud Config server. Students will learn how this can be used with or without a cloud oriented system like AWS. This technique can give great flexibility and manageability to any Spring-based deployment.
Students will create Spring Boot projects based mostly on Maven, but will also learn how to create the same projects using Gradle.
Then students will create a local GIT repository and pushing configuration files the students have created.
Then students will create remote Spring Boot clients to pull configuration from the Central config server, detailing out the various configuration that each remote application retrieve.
The students will then cover additional topics such as GIT TAG's and BRANCH's, and how applications can pull from them.
Students will also learn techniques for dynamically changing version of configuration to be pulled from a Spring Cloud Config server, for applications like parallel Microservice deployments.
Spring Cloud Config Server features:
@EnableConfigServerConfig Client features (for Spring applications):
Environment with remote property sources@ConfigurationProperties with remote property sourcenext...