Spring Cloud Commons - Interview Questions

What is Spring Cloud Commons?

 

Spring Cloud Commons, part of the Spring Cloud platform, provides two feature libraries: Spring Cloud Context and Spring Cloud Commons.

Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints).

Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).

Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).

What are the key features provided in Spring Cloud Context library?

 

Spring Cloud Context library provides the following key features

Bootstrap context

TextEncryptor beans

Refresh Scope

Spring Boot Actuator endpoints for manipulating the environment

What are the key features provided in Spring Cloud Commons library?

 

Spring Cloud Commons library provides the following key features that are used in different Spring Cloud implementations such as Spring Cloud Netflix.

DiscoveryClient interface

ServiceRegistry interface

What is a bootstrap context?

 

A Spring cloud application creates a new context called the 'bootstrap' context for the main application. Bootstrap context is responsible for loading configuration properties from external sources. Bootstrap properties have higher precedence, so they cannot be overridden by local configuration.

What is the purpose of @EnableDiscoveryClient annotation?

 

Spring Cloud Commons library provides the @EnableDiscoveryClient annotation that looks for implementations of DiscoveryClient interface using 'spring.factories'.

Example of DiscoveryClient implementations are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.

What is the purpose of ServiceRegistey interface provided in Spring Cloud Commons library?

 

Spring Cloud Commons library provides the ServiceRegistry interface which provides methods to register and deregister customer services.