Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring: Microservices with Spring Boot

You're reading from   Spring: Microservices with Spring Boot Build and deploy microservices with Spring Boot

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher
ISBN-13 9781789132588
Length 140 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
In28Minutes Official In28Minutes Official
Author Profile Icon In28Minutes Official
In28Minutes Official
Arrow right icon
View More author details
Toc

What is Spring Boot?

First of all, let's start with clearing out a few misconceptions about Spring Boot:

  • Spring Boot is not a code generation framework. It does not generate any code.
  • Spring Boot is neither an application server, nor is it a web server. It provides good integration with different ranges of applications and web servers.
  • Spring Boot does not implement any specific frameworks or specifications.

These questions still remain:

  • What is Spring Boot?
  • Why has it become so popular in the last couple of years?

To answer these questions, let's build a quick example. Let's consider an example application that you want to quickly prototype.

Building a Quick Prototype for a Microservice

Let's say we want to build a microservice with Spring MVC and use JPA (with Hibernate as the implementation) to connect to the database.

Let's consider the steps in setting up such an application:

  1. Decide which versions of Spring MVC, JPA and Hibernate to use.
  2. Set up a Spring context to wire all the different layers together.
  3. Set up a web layer with Spring MVC (including Spring MVC configuration):
    • Configure beans for DispatcherServlet, handler, resolvers, view resolvers, and so on
  4. Set up Hibernate in the data layer:
    • Configure beans for SessionFactory, data source, and so on
  5. Decide and implement how to store your application configuration, which varies between different environments.
  6. Decide how you would want to do your unit testing.
  7. Decide and implement your transaction management strategy.
  8. Decide and implement how to implement security.
  9. Set up your logging framework.
  10. Decide and implement how you want to monitor your application in production.
  11. Decide and implement a metrics management system to provide statistics about the application.
  12. Decide and implement how to deploy your application to a web or application server.

At least a few of the steps mentioned have to be completed before we can start with building our business logic. And this might take a few weeks at the least.

When we build microservices, we would want to make a quick start. All the preceding steps will not make it easy to develop a microservice. And that's the problem Spring Boot aims to solve.

The following quote is an extract from the Spring Boot website (http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-documentation):

Spring Boot makes it easy to create stand-alone, production-grade Spring based applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration

Spring Boot enables developers to focus on the business logic behind their microservice. It aims to take care of all the nitty-gritty technical details involved in developing microservices.

Primary Goals

The primary goals of Spring Boot are as follows:

  • Enable quickly getting off the ground with Spring-based projects.
  • Be opinionated. Make default assumptions based on common usage. Provide configuration options to handle deviations from defaults.
  • Provide a wide range of nonfunctional features out of the box.
  • Do not use code generation and avoid using a lot of XML configuration.

Nonfunctional Features

A few of the nonfunctional features provided by Spring Boot are as follows:

  • Default handling of versioning and configuration of a wide range of frameworks, servers, and specifications
  • Default options for application security
  • Default application metrics with possibilities to extend
  • Basic application monitoring using health checks
  • Multiple options for externalized configuration
You have been reading a chapter from
Spring: Microservices with Spring Boot
Published in: Mar 2018
Publisher:
ISBN-13: 9781789132588
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image