This will be a short article about introducing Spring Boot, and we will discuss "What is Spring Boot"? And how Spring Boot can help build Java-based enterprise applications.
As Java developers, we are likely to use applications based on Spring framework directly or indirectly. Spring has many ways to configure its behavior. It provides the option to use XML-based configurations or annotations. JavaConfig is becoming the de facto standard for new Spring-based applications. Although these options look very good, these configurations can become very complicated for large enterprise applications involving hundreds of modules and complex business rules. The following are some complicated problems that large-scale applications may bring to pictures.
All the above problems are related to ensuring that we have everything before the development team starts to deal with the actual tasks. Now let's discuss another use case, which we use to deal with any Spring-based application. Suppose we want to create a Web-based application. These are the most common steps that most of us often do.
Depending on our application type, this list will increase significantly.
All the above steps are obvious to us, but they add a lot of expenses to the development team instead of focusing on solving the actual business problems, which will consume the initial time to ensure that everything starts working in the right place. Think of Spring Boot as a tool that can automatically complete these initial tasks for us, ensuring that the team can quickly start solving practical business problems instead of spending time on initial configuration and setup.
Spring Boot provides the following out-of-the-box functions
With Spring Boot, you can easily manage and deal with the problems highlighted in the introduction section. . During the upgrade process, we don't need to manually search for compatible jars, and Spring Boot will ensure that our application is upgraded to the correct version (this is called working on the application and minimizing it).
Let's look at an example of a pom.xml Web application to understand the sample Spring Boot configuration.
Just pay close attention
As long as you look at the configuration carefully, you won't find any entries of all Spring dependencies (such as Web MVC, Core, AOP, ORM, Validation API, etc.). ). You may have noticed a similar entry spring-boot-starter-*, which is the Spring Boot dependency management process. We have added spring-boot-starter-web to our pom.xml, and Spring Boot will extract all necessary dependencies of Spring MVC application (no manual configuration is required).
Automatic configuration is another interesting feature of Spring Boot, which is why the Spring Boot team says it has a problem.
Do you remember the process of deploying applications on Servlet containers (Tomcat, etc.)? )? Every time we make these small changes, we need to deploy them to the application server to test our changes?
Spring Boot provides support for embedded Servlet containers. We no longer need to deploy our application on the application server (it can be easily run using the standard main method), but at the same time we can use http:/< host >: <; Port >
Spring-boot-starter-Webentrypom.xml will provide an embedded servlet container for our web application. Apache Tomcat is the default servlet container provided by Spring Boot. However, Spring Boot provides a way to use other servlet containers (we must add the required initiators for this).