Introduction to Spring Boot Framework
What is Spring Boot?
Spring Boot is a popular, open-source, enterprise-level framework for creating standalone, production-grade applications that run on the Java Virtual Machine (JVM).
It requires minimal or zero configuration and is easy to get started. It is a widely popular choice among Java developers for developing MicroServices and web applications.
Spring boot is built on top of the popular Spring Framework and inherits features like dependency injection(DI) or Inversion of Control (IoC) from the Spring.
It offers built-in support for typical tasks that an application needs to perform, such as data binding, type conversion, validation, exception handling, resource and event management, internationalization, and more.
What we can do with Spring Boot?
Spring Boot framework provides a number of features that make it ideal for building a variety of applications, including:
- Web applications: You can create simple to complex multi-tire web applications
- RESTful APIs: Spring Boot makes it easy to create RESTful APIs to expose your data and functionality to other applications.
- Microservices: Widely used choice for building small, independent services that can be easily scaled and deployed.
- Batch processing: You can build a Spring batch application that can process large volume of data in a scheduled or event-driven manner.
- Command line applications: Spring Boot also can be used to build applications that run on the command line.
Key Features of Spring Boot
Some of the key features of Spring Boot framework are:
- Dependency Injection (DI)
- Spring Boot Starter Dependencies
- Embedded Server
- Production-ready features
Spring Boot applications are initialized with pre-set dependencies so you don’t have to configure the underlying Spring Framework and third-party packages manually for your application.
This helps developers to reduce the number of errors caused due to misconfiguration and makes them more productive.
Dependency Injection is one of the core features of the Spring framework. This allows developers to write loosely coupled code that is easy to maintain and test.
Dependency Injection (DI) is a software design pattern used in object-oriented programming, where the dependencies of a class are provided by an external entity rather than being created within the class itself.
In other words, instead of a class creating its own dependencies, those dependencies are "injected" into the class from outside.
Spring Boot Starter Dependencies
Dependency management is one of the critical parts of any project development. Managing this manually is very cumbersome and error-prone. Spring Boot provides us with several Spring Boot starter packages to address this problem.
There are two types of dependencies:
- Direct: These are dependencies defined in
build.gradlefile under the
- Transitive: These are dependencies that are dependencies of your direct dependencies.
For example, if we add the
spring-boot-starter-web as a dependency to your
pom.xml file then will
spring-boot-starter-tomcat as the direct dependency and with that it will also
download the other transitive dependencies like
If you’re managing the dependencies manually, then you must be very careful about the specific version of the dependency you are using and also need to worry about their compatibility with each other.
The built-in Spring Boot starters help you to simplify the build configuration and make the development very rapid and easy.
Starter dependencies are a set of convenient dependency descriptors that we can use to bootstrap our Spring boot applications. The Spring Boot starters contain a lot of pre-defined dependencies with a supported set of transitive dependencies.
Spring Boot starters follow a similar naming
spring-boot-starter-XYZ, where XYZ denotes a particular type of
Here are some of the popular Spring Boot starter packages:
|spring-boot-starter-web||It is used for building web applications, including RESTful applications using Spring MVC. It uses Tomcat as the default embedded container.|
|spring-boot-starter-activemq||It is used in JMS messaging using Apache ActiveMQ.|
|spring-boot-starter-actuator||Provides production-ready features such as health checks, monitoring, and other application management features.|
|spring-boot-starter-batch||It is used for the Spring Batch.|
|spring-boot-starter-cache||It is used for Spring Framework's caching support.|
|spring-boot-starter-data-jpa||It is used for Spring Data JPA with Hibernate.|
|spring-boot-starter-data-mongodb||It is used for MongoDB document-oriented database and Spring Data MongoDB.|
|spring-boot-starter-mail||It is used to support Java Mail and Spring Framework's email sending.|
Spring Boot includes support for embedded Tomcat, Jetty and Undertow servers. This means you don’t need any external web servers and no need to deploy WAR files anymore.
The embedded Tomcat server is available through
However, if you want Jetty or Undertow servers
then you can
Production Ready Features
Spring Boot Framework includes production-ready features such as metrics, health checks, and external configuration management. Spring Boot also provides integration with various enterprise technologies such as RMI, JPA and JMS, AMQP, etc.
- WebSocket API (JSR 356)
- AMQP - Advanced Message Queuing Protocol
- Java Web Services
- JPA () - Java Persistence API
Spring also provides a Model-View-Controller (MVC) framework that simplifies the development of web applications by separating the presentation layer from the business logic.
It also provides a number of tools and frameworks for testing applications, including the Spring Test Framework and the Spring MVC Test Framework.
Spring Boot vs. Spring: What Works for You?
Ultimately, the best framework for you will depend on your specific requirements. If you are not sure which framework to choose, I recommend starting with Spring Boot.
|Source type||It is an open-source framework.||It is built on top of a spring.|
|Core features||Dependency injection||Auto-configuration is an essential feature.|
|Deployment||The server is set explicitly for spring. The deployment descriptor is required.||Embedded servers are provided. The deployment descriptor is not required.|
|Use cases||Good for complex applications.||Good for rapid application development|
|Setup time||It takes more time to set up.||Faster to set up.|
Spring Boot is a great choice to get started with Spring development without having to worry about the complexities of the Spring Framework. Once you understand Spring better, you can decide if you need the additional features and flexibility of the Spring Framework.
Sharing is caring!
Did you like what wrote? Thank them for their work by sharing it on social media.