Spring

A brief history of Spring

For the first implementation of our reference architecture, we will employ the Spring framework. The Spring framework is a mature, open-source, Java-based application framework with a long history as the primary alternative to the Java Platform, Enterprise Edition (JEE). The first version of the Spring framework was created by Rod Johnson in 2002 in parallel with the publication of his book Expert One-on-One J2EE Design and Development.

Spring's origins were, in large part, a reaction to deficiencies Johnson identified within JEE, specifically, issues with the JEE's Enterprise Java Bean (EJB) component framework and a lack of an end-to-end solution. Spring attempted to remedy the deficiencies by introducing a more straightforward mechanism based on plain-old-java-objects(POJO) and the introduction of an Inversion of Control (IoC) container. With the IoC (AKA Dependency Injection) container, the framework makes calls to application-specific code rather than the application code making calls to framework libraries.

With Spring, applications are composed of a set of loosely coupled components that are wired together at runtime by the framework. This loosely coupled approach makes testing simpler and runtime application configuration possible. Through a comprehensive portfolio of supporting modules, Spring provides a large complement of the most common application components needed to develop enterprise applications. Because of these supporting modules, Spring is usually characterized as an application framework, rather than a web framework.

Spring Boot

In 2012, a feature request was opened requesting a containerless web application architecture within the Spring ecosystem. From that feature request, Spring Boot emerged. With Spring Boot, developers get an "opinionated" architecture that employs a convention-over-configuration approach to application development. This approach significantly simplifies the process of selecting and configuring both Spring & third-party support libraries allowing developers to be more productive quicker.

Spring boot gets developers started quicker as well as supply non-functional features often needed by most applications (e.g., security, metrics, health checks, externalized configuration.). Additionally, Spring Boot supported the embedding of Apache Tomcat or Jetty directly into the application. By embedding the webserver directly into the application, Spring Boot applications can be packaged as self-contained jar files that can be run directly via the java -jar command. This approach makes Spring Boot an excellent framework for building microservices.

Spring Cloud

Spring Cloud builds on the Spring Boot platform to deliver additional support for many of the microservice patterns we have seen in previous articles in this series. Spring Cloud provides support for:

  • Distributed Configuration
  • Service Registry and Discovery
  • Service Routing
  • Load balancing
  • Circuit Breakers
  • Distributed Messaging
In our Spring-based reference implementation, we will be leveraging many of these Spring Cloud tools to reduce the amount of code we need to write.

Spring Boot Actuator

Spring Boot Actuator is a Spring library that provides Spring Boot services with a mechanism for external monitoring and management. When it is enabled, Spring Boot Actuator exposes a web endpoint that provides real-time statistics reflecting the current state of the service and its JVM. The endpoint is polled by an external monitoring service (in this case, a Prometheus instance) to capture the operational history of the service.

Coming Up

In our next article, we will take a quick detour to discuss some of the tools we will be using to develop our reference implementation.