Spring Boot Framework

Spring Boot is probably the fastest way to get a Spring application up and running within less than 5 minutes and a very few little lines of code. I like to think at Spring Boot as a framework that takes most of the work out when it comes to configuring Spring-based applications.

Spring Boot makes developer faster and deployment easier !

A Spring Boot application is annotated with @SpringBootApplication and it is a shortcut annotation which applies three annotation in one statement: @Configuration, @EnableAutoConfiguration and @ComponentScan.

Spring vs. Spring Boot

Spring Boot is an opinionated production ready-way to consume spring, which provides conventions over configuration to Spring (aka, it allows you to manage dependencies). Spring Boot provides sensible default, automatic configuration, and support for embedded HTTP server.

You can think as spring boot as spring + tomcat (or any other application server) – configuration.

Spring Boot features

  • automatic configuration – spring boot emphasize conventions over configuration. Auto configuration looks on the jars in the classpath and auto-configure beans accordingly. Note that auto-configuration beans is applied after the user defined bean configuration;
  • starter dependencies;
  • command line interface – used for rapid prototyping;
  • actuator – allows you to see what is going inside your running application. By using Spring Boot Actuator you can uses HTTP endpoints or JMX to see various metrics about your application: health status, metrics, loggers, audit, events, HTTP trace.

Spring MVC

Spring MVC is the part of spring that allows you to develop web applications. It is commonly used to:

  • develop HTML web applications
  • develop REST endpoints
  • serve single page applications

M : Model = Representation of data in a system (sometimes is it called entity or domain model);
V : View = Responsible for displaying data (aka. the model);
C : Controller = Responsible for directing incoming user requests, and sends responses back to the user (aka. the view).

Spring Data

Spring Data provides polyglot persistence within Spring. It provides a consistent programming model for a variety of different persistence stores: JDBC, JPA, MongoDB, Neo4J, Redis, Elasticsearch, Solr, Gemfire, Cassandra, Couchbase.

Spring Data provides a CrudRepository (support for create, read, update, delete operation over databases), and paging and sorting support. It also provides custom finder method support, for instance:

is equal to

There are different finder method which can be used:

  • findByDestinationAndCost
  • findByDestinationOrDeparturePlace
  • findByStartDateBetween
  • findByCostLessThan
  • findByDestinationLikeIngnoringCase

Spring Data also offers template classes (same idea as JdbcTemplate). Template classes provides consistent ways for working with persistence stores. Example: mongoTemplate.

Three different ways to start with spring boot

From my experience there are three ways to start a spring boot project.

Using the spring boot command line interface (CLI)

brew tap pivotal/tap && brew install springboot

You can also download and install the spring boot CLI. To perform this activity follow the instruction here.

To check the version of your installed CLI use: spring –version

With Spring Tool Suite or IntelliJ

Open your IDE of choice and navigate to: File -> New -> Spring Starter Project

Using Spring Initializer

Spring initializer is available at http://start.spring.io/.

Spread the love

Leave a Reply