Wednesday, 13 May 2020

Spring to Spring boot

About Spring
What is Spring:
The Spring Framework is one of the most popular open source application development frameworks for Java. 
One of the best features in Spring is that it has the Dependency Injection (DI) or Inversion Of Control (IOC). 
which allows us to develop loosely coupled applications. And, loosely coupled applications can be easily unit-tested. 

Spring Modules:
Spring Framework is enrich with several modules, its categorized approx 22 modules to cater many common problems.
some of the popular modules are – 
§  Spring JDBC
§  Spring MVC
§  Spring AOP
§  Spring ORM
§  Spring JMS
§  Spring Test
§  Spring Expression Language (SpEL)

Why Do We Need Spring Boot?
Problem faced to build an end to end enterprise application in Spring Framework –
·  It takes a lot of time for a developer to set up a basic project using Spring MVC with minimum functionality.
·  There was lot of difficulty to setup Hibernate Datasource, Entity Manager, Session Factory, and Transaction Management.
·  How do you package and deploy this application to your web server. 
·  With Spring MVC you have to manually write the configurations, XML files, etc. for deploying to web server.
·  Whole application is build and deployed on application server as one entity.
·  Its difficult to manage, scale and maintain the application.
·  Issue in one module of an application will impact to entire application.

What is Spring Boot and how Does Spring Boot Solve This Problem?
Spring Boot is basically an extension of the Spring framework which eliminated the boilerplate configurations required for setting up a Spring application.
ü    It takes an opinionated view of the Spring platform which paved the way for a faster and more efficient development eco-system.
ü    Spring Boot use AutoConfiguration, it will take care of all the internal dependencies that your application needs.
ü    Spring Boot will auto-configure with the Dispatcher Servlet, if Spring jar  is in the class path.
ü    It will auto-configue to the datasource, if Hibernate jar  is in the class path.
ü    Spring Boot gives us a pre-configured set of  Starter Projects to be added as a dependency in our project.
ü    Spring boot works with opinionated ‘starter’ dependencies to simplify build and application configuration
ü    It takes Zero XML configuration in your project, you don't need deployment descriptor, web server, etc.
ü    Spring Boot is magical framework that bundles all the dependencies for you.
ü    It has embedded server to avoid complexity in application deployment, your web application will be a standalone JAR file with this embeded servers.
ü    One fat application can be break into separate independent application(s), each one can be develop/manage/maintain and scale independently.
ü    Other than this it has Metrics, Helth check, and externalized configuration,automatic config for Spring functionality – whenever possible

Starter dependencies
Spring Boot provides a number of starter dependencies for different Spring modules. Some of the most commonly used ones are: –
§  spring-boot-starter-web-services: SOAP Web Services
§  spring-boot-starter-web: Web and RESTful applications
§  spring-boot-starter-test: Unit testing and Integration Testing
§  spring-boot-starter-data-jpa: Spring Data JPA with Hibernate
§  spring-boot-starter-jdbc: Traditional JDBC
§  spring-boot-starter-data-rest: Expose Simple REST Services using Spring Data REST
§  spring-boot-starter-security: Authentication and Authorization using Spring Security
§  spring-boot-starter-cache: Enabling Spring Framework’s caching support

Spring to Spring boot

About Spring What is Spring: The Spring Framework is one of the most popular open source application development frameworks for Java.  ...