DEV Community

Cover image for What is Spring Boot and what are its advantages?
Thailane Lopes Dutra
Thailane Lopes Dutra

Posted on

What is Spring Boot and what are its advantages?

Brief history

Spring came into being in 2003 as a response to the complexity of the early J2EE specifications. While some consider Java EE and its modern-day successor Jakarta EE to be in competition with Spring, they are in fact complementary. The Spring programming model does not embrace the Jakarta EE platform specification; rather, it integrates with carefully selected individual specifications from the traditional EE umbrella.

Spring Boot is a project within the Spring ecosystem that helps us create standalone applications that do not rely on anything else; they work on their own, with the only requirement being Java, which must be installed for them to function. Spring Boot assists with infrastructure tasks, managing the configuration of our project’s infrastructure, especially with the initial setup needed to start coding and implementing business logic, allowing for a more organized project and easier deployment to production.

Some advantages of Spring Boot:

  1. Convention Over Configuration: Spring Boot configures the project based on conventions it adopts. For example, if you want to use JPA, it already includes a dependency that adds sub-dependencies, such as the JPA API, what’s needed for RabbitMQ, etc. The versions of these sub-dependencies are already compatible with each other, tested by the entire Spring Boot community and team. Besides this example, there are a series of dependencies you can configure for your project.

  2. Embedded Server: Spring Boot comes with an embedded server, with Tomcat being the default. This greatly simplifies development because you don’t need to download a server, and it also simplifies production since you don’t need to have or download a server. You can simply take the application, deploy it to production, and have an embedded server ready to run the application.

  3. Organized POM.XML: If you use Maven, you know the POM can sometimes get messy, but with Spring Boot, it’s easier to keep the pom.xml organized. You avoid adding multiple dependencies and checking if they are compatible with each other.

  4. DevTools: Spring Boot provides DevTools, which automatically restarts the project upon any changes made. It also allows for some convenient configurations for development without manually setting them in the application.properties (the configuration file). For HTML page caching, DevTools disable it, so you don’t need to restart the application when making changes to HTML.

  5. LiveReload Integration: When an HTML page is modified, the cache is disabled, and LiveReload integration is enabled, so when returning to the browser, there’s no need to press F5; it updates automatically.

  6. Metrics Analysis: Spring Boot includes the Actuator dependency, which helps monitor and manage the health of the application, allowing you to view and monitor resource usage, especially on production servers. It does this without generating source code lines, and you can customize it just like any other project without Spring Boot. It will detect your configurations and avoid applying its own.

Image description

  1. STS IDE: This IDE helps with any Spring ecosystem project, including Spring Boot. For instance, if you want to create a Spring Boot project using STS, you only need to select the “start project” option in the IDE, fill in the required details, select the dependencies you want, and it will download and configure the project, making it ready to use.

Image description

  1. Package Generation: Spring Boot generates a JAR package, but it’s a JAR with its own specific structure needed for the standalone setup. It includes the source code, dependencies, and the embedded server, but the command to run this JAR is the same as running any other JAR:
   java -jar target/something-api-1.0.0-SNAPSHOT.jar
Enter fullscreen mode Exit fullscreen mode

These are some of the great features of Spring Boot that can make you a more productive developer and make working with Spring Boot easier in your day-to-day tasks.

Reference: https://spring.io/projects/spring-boot

Top comments (2)

Collapse
 
dogers profile image
Dogers

How about the disadvantages..? :)

Collapse
 
thailanelopes profile image
Thailane Lopes Dutra

Hey Dogers, how's it going?

Well, haha, I'm biased when it comes to talking about the disadvantages of the Spring ecosystem, because in the projects I work on, Spring and Spring Boot make a lot of sense.

That said, my answer is: it depends on the project you're going to build. It's always important to analyze this because Spring might not make much sense for certain types of projects.

As soon as possible, I will look into some projects where using Spring Boot would not be the best choice and would have more disadvantages than advantages, and I'll bring that in another article.

But this is a very interesting question, and I appreciate it, my friend.