Book Image

Mastering Spring 5.0

By : In28Minutes Official
Book Image

Mastering Spring 5.0

By: In28Minutes Official

Overview of this book

Spring 5.0 is due to arrive with a myriad of new and exciting features that will change the way we’ve used the framework so far. This book will show you this evolution—from solving the problems of testable applications to building distributed applications on the cloud. The book begins with an insight into the new features in Spring 5.0 and shows you how to build an application using Spring MVC. You will realize how application architectures have evolved from monoliths to those built around microservices. You will then get a thorough understanding of how to build and extend microservices using Spring Boot. You will also understand how to build and deploy Cloud-Native microservices with Spring Cloud. The advanced features of Spring Boot will be illustrated through powerful examples. We will be introduced to a JVM language that’s quickly gaining popularity - Kotlin. Also, we will discuss how to set up a Kotlin project in Eclipse. By the end of the book, you will be equipped with the knowledge and best practices required to develop microservices with the Spring Framework.
Table of Contents (20 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Spring Projects


While Spring Framework provides the base for core features of enterprise applications (DI, web, data), other Spring Projects explore integration and solutions to other problems in the enterprise space--deployment, Cloud, Big Data, Batch and Security, among others.

Some of the important Spring Projects are listed as follows:

  • Spring Boot
  • Spring Cloud
  • Spring Data
  • Spring Batch
  • Spring Security
  • Spring HATEOAS

Spring Boot

Some of the challenges while developing microservices and web applications are as follows:

  • Making framework choices and deciding compatible framework versions
  • Providing mechanisms for externalizing configuration--properties that can change from one environment to another
  • Health checks and monitoring--providing alerts if a specific part of the application is down
  • Deciding the deployment environment and configuring the application for it

Spring Boot solves all these problems out of the box by taking an opinionated view of how applications have to be developed.

We will look at Spring Boot in depth in two chapters--Chapter 5, Building Microservices with Spring Boot and Chapter 7, Advanced Spring Boot Features.

Spring Cloud

It is not an exaggeration to say The world is moving to the Cloud.

Cloud Native microservices and applications are the order of the day. We will discuss this in detail in Chapter 4, Evolution toward Microservices and Cloud-Native Applications.

Spring is taking rapid strides toward making application development for the Cloud simpler with Spring Cloud.

Spring Cloud provides solutions for common patterns in distributed systems. Spring Cloud enables developers to quickly create applications that implement common patterns. Some of the common patterns implemented in Spring Cloud are listed as follows:

  • Configuration management
  • Service discovery
  • Circuit breakers
  • Intelligent routing

We will discuss Spring Cloud and its varied range features in more detail in Chapter 9, Spring Cloud.

Spring Data

There are multiple sources of data in today's world--SQL (relational) and a variety of NOSQL databases. Spring Data tries to provide a consistent data-access approach to all these different kinds of databases.

Spring Data provides integration with a varied range of specifications and/or data stores:

  • JPA
  • MongoDB
  • Redis
  • Solr
  • Gemfire
  • Apache Cassandra

Some of the important features are listed as follows:

  • Provides abstractions around repository and object mappings--by determining queries from method names
  • Simple Spring integration
  • Integration with Spring MVC controllers
  • Advanced automatic auditing features--created by, created date, last changed by, and last changed date

We will discuss Spring Data in more detail in Chapter 8, Spring Data.

Spring Batch

Enterprise applications today process large volumes of data using batch programs. The needs of these applications are very similar. Spring Batch provides solutions for high- volume batch programs with high performance requirements.

Important features in Spring Batch are as follows:

  • The ability to start, stop, and restart jobs--including the ability to restart failed jobs from the point where they failed
  • The ability to process data in chunks
  • The ability to retry steps or to skip steps on failure
  • Web-based administration interface

Spring Security

Authentication is the process of identifying the user. Authorization is the process of ensuring that a user has access to perform the identified action on the resource.

Authentication and authorization are critical parts of Enterprise applications, both web applications and web services. Spring Security provides declarative authentication and authorization for Java based applications.

Important features in Spring Security are as follows:

  • Simplified authentication and authorization
  • Great integration with Spring MVC and Servlet APIs
  • Support to prevent common security attacks--cross-site forgery request (CSRF) and Session Fixation
  • Modules available for integration with SAML and LDAP

We will discuss how to secure web applications with Spring Security in Chapter 3, Building Web Application with Spring MVC.

We will discuss how to secure REST Services with Basic and OAuth authentication mechanisms using Spring Security in Chapter 6, Extending Microservices.

Spring HATEOAS

HATEOAS stands for Hypermedia as The Engine of Application State. Though it sounds complex, it is quite a simple concept. Its main aim is to decouple the server (the provider of the service) from the client (the consumer of the service).

The service provider provides the service consumer with information about what other actions can be performed on the resource.

Spring HATEOAS provides a HATEOAS implementation--especially for the REST services implemented with Spring MVC.

Important features in Spring HATEOAS are as follows:

  • Simplified definition of links pointing to service methods, making the links less fragile
  • Support for JAXB (XML-based) and JSON integration
  • Support for service consumer (client side)

We will discuss how to use HATEOAS in Chapter 6, Extending Microservices.