EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Spring Tutorial What is Spring Cloud?
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

What is Spring Cloud?

By Priya PedamkarPriya Pedamkar

what is spring cloud

Introduction to Spring Cloud

Spring Cloud is defined as an open-source library that provides tools for quickly deploying the JVM based application on the clouds, it provides an extensible mechanism and a better user experience than its competitors due to various features like Distributed configuration, Circuit breakers, Global locks, Service registrations, Load balancing, Cluster state, Routing, Load Balancing, etc, it is also capable of working with spring and different applications in various different languages

Features of Spring Cloud

Spring Cloud provides a better experience and an extensible mechanism that others. Major features of Spring cloud are:

  • Distributed configuration
  • Distributed messaging
  • service-to-service calls
  • Circuit breakers
  • Global locks
  • Service registration
  • Service Discovery
  • Load balancing
  • Cluster state
  • Routing

Why we should require Spring Cloud?

We face the following issues during the development of distributed microservices using Spring Boot:

  • Performance issues: Different operational overheads affects performance badly.
  • Complexity in deployment: DevOps skills are required.
  • Redundancy: Distributed system often faces redundancy issues.
  • Load–balancing: Workload distribution across various computing resources are improved by Load Balancing.
  • Distributed system complexities: Complexities include bandwidth issues, network issues, security issues, latency issues, etc.
  • Service directory tools: These tools let the processes and services in the same cluster talk to each other.

How does it work?

Below is the explanation of how Spring Cloud works:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

  • Spring Cloud Config provides client-side and server support for various configurations in distributed systems.
  • It provides a centralized platform to manage various properties for all applications across different environments.
  • Both server and client concept maps to the Property Source abstractions and Spring applications identically.
  • They work properly with Spring applications and can be used with different applications in any language.
  • It lets you manage and configure all the environments when applications are moving through deployment pipelines from development to testing.
  • It also makes sure about all the necessities of an application when they migrate.
  • To add and plugin alternative implementations with Spring Cloud Config is easy.
  • The default value of spring.cloud.config.uri i.e. http://localhost:8888/ is being contacted by Spring Boot applications until Spring Config Client and Spring Boot Actuator are on the classpath.
  • You may change the default value spring.cloud.config.uri can be set in bootstrap.[yml | properties] or in system properties.

Code:

@Configuration
@EnableAutoConfiguration
@RestController
public class DemoApplication {
@Value("${config.name}")
String str = "Cloud";
@RequestMapping("/")
public String new() {
return "Spring " + str;
}
public static void main(String[] args) {
SpringApplication.run(DemoApp.class, args);
}
}
  • Local configuration or remote Config server can provide the value for name.
  • You can try running your own server using a spring-cloud-config-server.
  • To run the application on port 8888, you can set spring.config.name=configserver And the data then is served from sample repositories.
  • To locate the necessary configuration data, you may need spring.cloud.config.server.git.uri

Set-Up Spring Cloud

Below are the steps to follow:

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,328 ratings)

Step 1: Open the website https://start.spring.io/ and choose

Step 2: Select Spring Boot 1.4.X.

Step 3: Artifacts should be set to ‘config’.

Step 4: Add the config server’ module from the dependencies section.

Step 5: Click the Generate button to download a preconfigured project containing a zip file.

Step 6: You can also create a Spring Boot project by adding the dependencies to the POM file manually.

Step 7: These dependencies can be shared among all the projects.

Code:

<parent>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-parent </artifactId>
<version> 1.4.0.RELEASE </version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-test </artifactId>
<scope> test </scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-dependencies </artifactId>
<version> Brixton.SR5 </version>
<type> pom </type>
<scope> import </scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-maven-plugin </artifactId>
</plugin>
</plugins>
</build>

Step 8: Dependencies for the ‘config server’ is below:

Code:

<dependency>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-config-server </artifactId>
</dependency>

Step 9: The Application class should be added with the following to enable Config Server as mentioned in the previous example:

Code:

@SpringBootApplication
@EnableConfigServer
public class DemoApplication {
...
}

Step 10: The ‘application properties’ should be added to src/main/resources.

Code:

server.port = 8888
spring.application.name = config
spring.cloud.config.server.git.uri = file://${user.home}/application-config

Step 11: The Uri parameter is one of the most significant settings for the ‘config server’.

Step 12: On Windows, the Uri parameter is usually added to a relative path that resolves to

C:\users\<username>\. And on Linux, it is /users/<username>/.

Step 13: All the property files for various applications are stored in the above pointed Git repository.

Step 14: The folder ‘application-config’ should be then added to the folder cloud.config.server.git.uri.

Step 15: Navigate to that folder by using ‘cd’ command and then type git init.

Step 16: A Git repository will be initiated now, that lets you store and track your files.

Step 17: Run the config server to check whether it’s working.

Step 18: Type mvn spring-boot: run command in the command line to start the server.

Step 19: The following output will be seen as an indication for a successful server start:

Tomcat started on port(s): 8888 (HTTP)

Step 20: The config server manages the application properties in the servers.

Step 21: In the servers, each application’s properties should be configured in such a way that they should be able to talk back to the server.

Step 22: This process is a bootstrap process. Each of the applications should have a file called properties.

Step 23: It contains properties similar to application properties with few differences.

Step 24: The properties are initially loaded by a parent spring called Application Context.

Step 25: As it is critical, the config server will start the properties management of properties.

Step 26: The Application Context will also decrypt encrypted properties.

Step 27: These properties should be kept distinct.

Step 28: The properties initiate the config server and make it ready.

Step 29: The properties specify the properties for your application.

Step 30: Technically, the application properties can also be placed in properties.

Step 31: Though config servers are responsible for the management of application properties, we will still need the properties as they are available as default values and that is unavailable in config servers.

Conclusion

Various parts of Spring Cloud can be connected together into a functional Microservice application. This is a base platform that lets you build various complex applications. Spring Cloud lets you build powerful cloud applications. All the problems faced by distributed environments are solved by using Spring Cloud.

Recommended Articles

This is a guide to What is Spring Cloud. Here we discuss the introduction, features, requirements, working, and step-by-step setup of Spring Cloud. You can also go through our other related articles to learn more-

  1. What is Spring Boot?
  2. What is Salesforce Sales Cloud?
  3. Spring Cloud Components
  4. Spring Boot vs Spring MVC
Popular Course in this category
Cloud Computing Training (18 Courses, 5+ Projects)
  18 Online Courses |  5 Hands-on Projects |  102+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Spring Boot Training Program (2 Courses, 3 Project)4.9
Spring Framework Training (4 Courses, 6 Projects)4.8
All in One Data Science Bundle (360+ Courses, 50+ projects)4.7
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