官术网_书友最值得收藏!

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
主站蜘蛛池模板: 岑巩县| 毕节市| 扶风县| 宁武县| 福泉市| 柳河县| 祥云县| 河津市| 遂昌县| 横峰县| 原阳县| 辽源市| 洛南县| 象山县| 汝南县| 临澧县| 天祝| 根河市| 滕州市| 安顺市| 安龙县| 抚州市| 孟津县| 寿光市| 读书| 从化市| 雷州市| 唐山市| 措勤县| 江陵县| 南投市| 吉木萨尔县| 上高县| 沙河市| 巫溪县| 祁门县| 比如县| 乐清市| 剑川县| 绍兴县| 苏尼特右旗|