EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Spring Cloud Config

Secondary Sidebar
Spring Tutorial
  • Spring Cloud Basics
    • What is Spring Cloud
    • Spring Cloud Contract
    • Spring Cloud Components
    • Spring Cloud Version
    • Spring Cloud Data Flow
    • Spring cloud stream
    • Spring Cloud Dependencies
    • Spring cloud microservices
    • spring cloud gateway
    • Spring Cloud Config
    • Spring Cloud Kubernetes
    • Spring Cloud Sleuth
  • Spring
    • What is Spring Framework?
    • Spring Architecture
    • What is Spring Integration?
    • IoC Containers
    • What is AOP?
    • Spring Modules
    • Spring Batch Processing
    • Spring Batch Partitioner
    • Spring Batch Job
    • Spring AOP
    • Spring Expression Language
    • Dependency Injection in Spring
    • Spring Batch Architecture
    • Spring framework Interview Questions
  • Spring Boot
    • What is Spring Boot
    • Spring Boot flyway
    • Spring Boot framework
    • Spring Boot Logback
    • Spring Boot actuator endpoints
    • Spring Boot gRPC
    • Spring Boot jdbctemplate example
    • Spring Boot ehcache
    • Spring Boot Architecture
    • Spring Boot Port
    • Introduction of spring boot
    • Spring Boot ide
    • Spring Boot Netty
    • Spring Boot ORM
    • Spring Boot Versions
    • Spring Boot JUnit
    • Spring Boot Keycloak
    • Spring Boot gradle
    • Spring Boot Lombok
    • Spring Boot autowired
    • Spring Boot bean
    • Spring Boot hibernate
    • Spring Boot integration test
    • Spring Boot jdbc
    • Spring Boot MongoDB
    • Spring Boot postgresql
    • Spring Boot rest
    • Spring Boot swagger
    • Spring Boot thymeleaf
    • Spring Boot Unit Test
    • Spring Boot Webflux
    • Spring Boot webclient
    • Spring Boot kubernetes
    • Spring Boot Properties
    • Spring Boot Validation
    • Spring Boot Feature
    • Spring Boot Application
    • Spring Boot email
    • Spring Boot MVC
    • Spring Boot Exception Handling
    • Spring Boot Starter Parent
    • Spring Boot Docker
    • Spring Boot Logging
    • Spring Boot Query
    • Spring Boot Multiple Data Sources
    • Spring Boot Basic Authentication
    • Spring Boot Test
    • Spring Boot jwt
    • Spring Boot Liquibase
    • Spring Boot Prometheus
    • Spring Boot debug
    • Spring Boot GraalVM
    • Spring Boot Batch
    • Spring Boot controller
    • Spring Boot CLI
    • Spring Boot file upload
    • Spring Boot interceptor
    • Spring Boot Service
    • Spring Boot Configuration
    • Spring Boot Datasource Configuration
    • Spring Boot Annotations
    • Spring Boot Starter We
    • Spring Boot Actuator
    • Spring Boot DevTools
    • Spring Boot Repository
    • Spring Boot Dependencies
    • Spring Boot Path Variable
    • Spring Boot Microservices
    • Spring Boot Run Command
    • Spring Boot application.properties
    • Spring Boot Transaction Management
    • Spring Boot Banner
    • Spring Boot JPA
    • Spring Boot Change Port
    • Spring Boot RestTemplate
    • Spring Boot cors
    • Spring Boot HTTPS
    • Spring Boot OAuth2
    • Spring Boot Profiles
    • Spring Boot Interview Questions
    • Spring Boot filter
    • Spring boot logging level
    • Spring Boot Cache
    • Spring Boot Advantages
    • Spring Boot Scheduler
    • Spring Boot Initializr
    • Spring Boot Maven
    • Spring Boot Admin
    • Spring Boot Tomcat
    • Spring Boot WebSocket
    • Spring Boot Executable Jar
    • Spring Boot CommandLineRunner
    • Spring Boot DataSource
    • Spring boot grpc
    • Spring Batch Scheduler
    • Spring Batch Example
    • Spring Batch Tasklet
    • Spring Batch Admin
    • Spring Batch
    • Spring Boot Qualifier
    • Spring Boot War
    • Spring Boot Test Configuration

Related Courses

Spring Boot Certification Course

Spring Framework Course Training

All in One Data Science Course

Home Software Development Software Development Tutorials Spring Tutorial Spring Cloud Config

Spring Cloud Config

Definition of Spring Cloud Config

Spring cloud config is providing support of externalized configuration for a server-side and client-side system which was distributed. Using this we can manage the external properties of our all applications in a central place. Basically, spring boot config is the concept of client and server which was mapped identically in spring property source and environment. Using this, the environment and property source file are fit into the application very well.

What is spring cloud config?

  • At the time of developing our application is going from development to testing environment and then it will be going into the production environment, we can manage configuration in all environment using spring boot config, also it will manage all the thing which was required for the application for transferring it from one environment to another environment.
  • By default, It is implemented in git, so it will support the configuration of labeled version environment as well as it will accessible from managing content.
  • It is easy to add implementation and plug the same with spring configuration.
  • It is nothing but the client and server approach which was used to serve distributed configuration in multiple environments.
  • The configuration is stored in a version of git and it can be modified at the runtime of our application.
  • It is easy to fit into all spring applications by using all file format which was supported for the application.

Creating spring cloud config

  • First, we need to setup config server after creating config server we need to build the client which was used to consume the configuration at the time of server startup.
  • To develop an application we need the following software are as follows.

1) JDK 1.8 or later
2) Spring tool suite or Intellij IDEA
3) Maven 3.2+ or gradle 4+
4) IDE

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,064 ratings)
  • To start the application we need a git source repository we can download it or we can clone it from git.
  • At the time of creating the project template using spring initializer, we need to select config client or config server, spring web, and spring boot actuator dependency. This package is automatically added all dependency packages which was required to develop the application.
  • We can develop our regular spring boot application.

Spring cloud config quick start

  • To set up the project first step is to create a template by using spring initializer.
  • After creating the project template, we need to add spring cloud config dependency in pom.xml file of our application.
  • After adding dependency next step is to configure the implementation of server. We have used EnableConfigServer and SpringBootApplication annotation to config the server.
  • After implementing config server next step is to add our project in git repository as storage of configuration. In this step, we are initializing git repository by using configured URL.
  • After initializing git repository next step is querying our configuration changes by using server path.
  • After configuration, we have implemented the client of our application. We can implement client in easy steps.
  • After client implementation, we are implementing encryption and decryption in our application.
  • We can also provide enhanced security for the application.

Spring cloud config Server

The below example shows server implementation which is as follows.

1) Create a project template for the application –

In the below step, we have provided project group name as com. example, artifact name as springcloudconfig, project name as springcloudconfig, and selected java version as 8.

Group – com.example
Artifact name – springcloudconfig
Name – springcloudconfig
Spring boot – 2.6.0
Project – Maven
Project Description - Project for springcloudconfig
Java – 8
Dependencies – spring web, config server, spring boot actuator
Package name - com.example.springcloudconfig

Spring Cloud Config 4

2) After generating project extract files and open this project by using spring tool suite –

After generating the project by using spring initializer in this step we are extracting the jar file and opening the project by using the spring tool suite.

Spring Cloud Config 5

3) After opening project using spring tool suite check the project and its files –

In this step, we are checking all the project template files. We also need to check maven dependencies and system libraries.

Spring Cloud Config 6

4) Add dependency packages –

In this step, we are adding the required dependency to our project.

Code:

<dependency> -- Start of dependency tag.
<groupId>org.springframework.cloud</groupId> -- Start and end of groupId tag.
<artifactId>spring-cloud-config-server</artifactId> -- Start and end of artifactId tag.
</dependency> -- End of dependency tag.

Spring Cloud Config 7

5) Download and install git –

Spring Cloud Config 8

6) Create new directory using git –

Code:

# mkdir git-springconfig
# cd git-springconfig

Spring Cloud Config 9

7) Initialize git directory –

Code:

# git init

Spring Cloud Config 10

8) Add git folder to project –

Spring Cloud Config 11

9) Edit application. properties file

Code:

limits-service.maximum = 888
limits-service.minimum = 8

12

10) Add username and email

Code:

# git config --global user.email pqr@example.com
# git config --global user.name "pqr"
# git add -A

13

11) Run the application –

14

Server uses SSH configuration and properties

  • We can also use SSH configuration in the spring cloud config project. JGit requires the PEM format RSA keys.
  • To use SSH authentication in the remote repository we need to add username and password separately in the properties file.
  • It is the centralized application that was used to manage all the configuration related properties.
  • To develop an application we need to add spring cloud config server dependency in pom.xml file.
  • We can develop our application by using maven or gradle language. For developing applications using spring cloud config first we need cloud service which was act like an intermediate between repository version controlled configuration files and our spring application.

Conclusion

Spring cloud config is nothing but the client and server approach which was used for serving distributed configuration. Using spring cloud config we can manage the external properties of all applications. Spring cloud config is providing support of externalized configuration for server side and client-side system which was distributed.

Recommended Articles

This is a guide to Spring Cloud Config. Here we discuss the definition, What is spring cloud-config, Spring cloud config Server respectively. You may also have a look at the following articles to learn more –

  1. Spring Boot Scheduler
  2. Spring Boot Initializr
  3. Spring Boot Maven
  4. Spring Boot Cache
Popular Course in this category
Spring Boot Training Program (2 Courses, 3 Project)
  2 Online Courses |  3 Hands-on Projects |  22+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Spring Framework Training (4 Courses, 6 Projects)4.9
All in One Data Science Bundle (360+ Courses, 50+ projects)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Spring Boot Certification Course Learn More