How does Spring Boot work?

Bharath Thippireddy
A free video tutorial from Bharath Thippireddy
IT Architect and Best Selling Instructor- 300000+ students
4.4 instructor rating • 25 courses • 323,835 students

Learn more from the full course

Spring Framework In Easy Steps

Create an End to End Java EE Web Application using Spring

12:24:29 of on-demand video • Updated June 2020

  • Develop a web application with Spring MVC and Hibernate
  • Understand the Dependency Injection and Inversion of control
  • Master the Spring Bean Life Cycle
  • Configure the Spring container for Dependency Injection
  • Perform database operations using Spring JDBC
  • Perform object/relational mapping (ORM) with Hibernate
  • Use Spring MVC and Hibernate in a Single Java Web App
  • Make Ajax Call Using JQuery and Spring MVC
  • Get introduced to the fundamentals of various other Spring Modules
  • Understand the Aspect Oriented Programming Terminology
English So how does Spring Boot magic work? It's no magic. Spring does not generate any code on the fly, nor does it use any XML configuration. It is all programmatic configuration which you have done in a section earlier on. Instead of we creating a configuration, Java configuration, for web.xml or dispatcher servlet or configuring hibernate etc; Spring already has all those configuration classes in their jar files. The people at Spring have already created them, and they will be enabled based on certain conditions. So to understand that, you already know about the Starter POMs. When you add a Starter POM, it doesn't do any magic, Spring Boot magic. They simply bring in all the jars that are required for a certain type of projects, for standalone, for web, for REST, etc; But once you have these jars, these jars inside them have something called Spring.factories, under META-INF. These are already added by the Spring developers and these decide what should be enabled and what should be disabled, what programatic configuration should be enabled at runtime and what should be disabled. So everything, all the configuration is inside Java classes provided by Spring marked with @Configuration but conditionally. There is an annotation called @Condition. If you open up the spring source code and see how the configuration or the Spring Boot works, the classes they use. For example, for a substitution of web.xml they will have a Java configuration which would be marked with @Configuration and also @Condition. Only if it is a web project, then enable that particular configuration. Similarly, for HibernateJpaAutoConfiguration, only if there are certain hibernate related classes on the classpath, only then will Spring Boot enable the hibernate support or this particular HibernateJpaAutoConfiguration. So that is the magic behind the scenes. How Spring Boot works, it will look for META-INF/spring.factories which will have a list of configuration files and it will enable those configurations based on what it finds on the classpath.