Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use Spring Boot rather than Spring Boot-less? [closed]

I'm confused why should i use Spring Boot for my next project? Is Spring Boot as powerful as Spring Boot-less? Or there is something you can't do with Spring Boot.

like image 574
Yosua Lijanto Binar Avatar asked Aug 16 '15 08:08

Yosua Lijanto Binar


2 Answers

Spring Boot is opinionated Spring setup with batteries included. If you use it, you will waste less time on non-features because you will be getting quite a few things for free. List of advantages that I've observed compared to classical Spring setup (surely there are more, check the Spring Boot website):

  • dependency management - versions of commonly used libraries are pre-selected and grouped in different starter POMs that you can include in your project. By selecting one Spring Boot version you are implicitly selecting dozens of dependencies that you would have to otherwise select and harmonize yourself
  • auto-configuration - you do not have to manually configure dispatcher servlet, static resource mappings, property source loader, message converters etc.
  • advanced externalized configuration - there is a large list of bean properties that can be configured through application.properties file without touching java or xml config
  • "production ready" features - you get health checking, application and jvm metrics, jmx via http and a few more things for free
  • runnable jars - you can package your application as a runnable jar with embedded tomcat included so it presents a self-contained deployment unit

I haven't observed any disadvantages, it's just Spring after all. You can build anything that you could build with "vanilla" Spring, only faster.

like image 174
mzc Avatar answered Oct 18 '22 23:10

mzc


Here is my simple explanation:

Without Spring Boot, one will have to put the correct versions of all the dependencies in the build configuration file (e.g. pom.xml) and configure all the beans manually.

This seems like a lot of non-functional task for normal projects. Hence, Spring Boot does these automatically, assuming some conventions. For example, if you just include spring-boot-starter-web dependency in your pom.xml, a web application will be automatically configured by assuming default conventions.

What makes it more interesting is that the pieces of the default configuration can be very easily overridden.

Going through a couple of official guides would give more insight on Spring Boot. In summary, unless an application is abnormal enough, people seem to be preferring Spring Boot nowadays.

Coming to power, Spring Boot could be seen as just a configuration layer. So, everything possible in Spring should also be possible using Spring Boot.

like image 6
Sanjay Avatar answered Oct 18 '22 23:10

Sanjay