February 19, 2022

#SpringBoot : Tutorial Part 1



In this tutorial we will have some basic theoretical knowledge about Spring Boot.

What is Spring Boot?
  • Spring Boot is not a framework, it is a way to create stand-alone applications with minimal or zero configurations.
  • With Spring Boot we can develop spring based applications with very less configuration. It provides defaults for code and annotation configuration to quickly start new spring projects within no time.
  • It is a Spring module that provides the RAD (Rapid Application Development) feature to the Spring Framework. It comes with the auto-dependency resolution, embedded HTTP servers, auto-configuration, management endpoints and Spring Boot CLI.
  • SpringBoot uses convention over configuration software design paradigm, that's why in SpringBoot we don't have XML configuration (deployment descriptor) or beans defined with @Configuration. It had embedded HTTP servers. In short we can say Spring Boot is the combination of Spring Framework and Embedded Servers.

We can say,
Spring Boot = Spring Framework + Embedded HTTP servers (jetty/tomcat) - XML Configuration/ @Configuration

What is the difference between Spring and Spring Boot?
  • Spring is a web application framework based on Java, and Spring Boot is a module of Spring.
  • Spring provides tools and libraries to create customized web applications, where as Spring Boot is used to create a Spring application (standalone) project which can just run/ execute
  • Spring is more complex than Spring Boot.
  • It takes time to have spring application up and running. Whereas Spring Boot provides the shortest way to run a spring based application.
Why should we use Spring Boot Framework? What are the advantages and disadvantages of using Spring Boot?
Advantages:
  • It reduces the cost, development and testing time of the application, which inturn increases productivity.
  • It creates stand-alone Spring applications that can be started using Java -jar.
  • Use of JavaConfig helps avoid usage of XML.
  • Avoid lots of maven imports and the various version conflicts.
  • It avoids writing lots of boilerplate code, Annotations and XML configuration.
  • Provide an opinionated development approach.
  • Quick start to development by providing defaults.
  • It provides Embedded HTTP servers like Tomcat, Jetty etc. to develop and test our web applications very easily.
  • Requires less configuration-Since there is no web.xml file. Simply add classes annotated with@Configuration and then you can add methods annotated with@Bean, and Spring will automatically load up the object and manage it like it always has. You can even add @Autowired to the bean method to have Spring autowire in dependencies needed for the bean.
  • Environment Based Configuration-Using these properties, you can pass into the application which environment you are using with:-Dspring.profiles.active={enviornment}. Spring will then load up the subsequent application properties file at (application-{environment}.properties) after loading up the main application properties file.
  • It simplifies integration with other Java frameworks like JPA/Hibernate ORM, Struts, etc.
  • It provides production-ready features such as metrics, health checks, and externalized configuration.
Disadvantage:
  • It is a bit difficult and time consuming process to convert existing or legacy Spring Framework projects into Spring Boot Applications.
If you enjoy our content and want to support us, please consider donating via  gpay, phonepay or paytm on +91 9920600280. Also, I’d appreciate if you’d buy me a coffee☕ 

https://www.buymeacoffee.com/greekykhs


Keep learning and growing!
-K Himaanshu Shuklaa..

No comments:

Post a Comment