"Welcome To Ashok IT" "Spring Boot and MicroServices" Topic : Introduction To SpringBoot Date : 25/03/2025 (Session - 12) _____________________________________________________________________________________________________________________________ Today Session : Spring Boot =========================== * Spring boot is an open source java based framework developed by pivotal team/spring team for developing spring applications in easier way. * Spring boot is not sub module of Spring Framework, It is another Project from Pivotal Team / Spring Team. * Spring boot is not replacement of Spring Framework, It is extension of Spring Framework. Spring Boot = SpringFramework++ * Spring boot is developed on top of Spring Framework, What ever features we learned in spring framework it will works in spring boot as well. * Spring Boot is used to build Standalone Application and Production Ready Features for Spring Application Production Ready >> Spring Boot includes no of additional features to help you monitor and manage the Applications when its pushed to production. >> We can monitor the Application by using Http end points (or) JMX. >> Auditing,Health,Metrics gathering can also be automatically applied to your application. >> By using Actuators we can develop the Production ready features Spring Boot = Spring Framework - XML Configuration Features of Spring Boot ======================= 1) Create standalone Spring applications 2) Embed Tomcat(default), Jetty, Undertow directly (no need to deploy WAR files) >> Embedded Servers 3) Provide opinionated 'starter' dependencies to simplify your build configuration >> Starter Dependencies Starter Dependencies >>>> It is special type of POM and it can be download dependencies required for project. Every Starter in spring boot will have some common prefix i.e.,spring-boot-starter-*. Spring boot provides some of starters below i) Spring-boot-starter-web >>>>>>> To Download dependencies(Jars) required for the Web/Distributed Application Development. ii) spring-boot-starter-data-jdbc >>>>>>> It will download dependencies(Jars) required for developing persistence logic using Jdbc iii) spring-boot-starter-data-jpa >>>>>> It will download dependencies(Jars) required for developing persistence logic using ORM. Fore More Starters information : ================================ https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.build-systems.starters 4) Automatically configure Spring and 3rd party libraries whenever possible >> Auto Configuration Auto Configuration >>>> Automatically doing configuration of certain java classes as Spring Beans. Traditional Spring Application Development ========================================== * As a Programmer we need to certain java class as spring bean in following approaches i) XML configuration ii) Java Based Configuration iii) Annotation Configuration * Whenever we are developing webapplication using Spring MVC Module as aprogrammer we need to do the following things i) Configuring the DispatcherServlet in web.xml ii) Enabling the load on startup for DispatcherServlet by Spring IOC container iii) We need to provide the location of Spring Configuration file. * In Spring Boot MVC Development we no need to do above configuration because Spring boot having feature "Auto Configuration" through the DispatcherServlet will as spring bean by default adding following starter i.e.,spring- boot-starter-web similary to this one JdbcTemplate,NamedParameterJdbcTemplate will becomes as spring bean automatically when you include following starter i.e.,spring-boot-starter-data-jdbc. 5) Provide production-ready features such as metrics, health checks, and externalized configuration >> production ready features 6) Absolutely no code generation and no requirement for XML configuration >> No XML Configuration 7) Spring Boot Application also supports Embedded Databases /In-Memory Databases. 8) Spring Boot Application automatically container will be activated based on starter Selection. 9) Version Management NOTE ==== Embedded Server >> The server which comes along with Spring Boot Application called Emebedded Servers Eg: Tomcat (default) Embedded database >> The Database which comes along with Spring boot Application called "In-Memory Databases" Eg: h2 Starter Dependencies >> Special type of Dependencies managed in pom.xml AutoConfiguration >> When you add the starters to Spring boot automatically certain java class will becomes Spring beans and Performs Dependency Injection as well. 100% XML Configuration is not required "Spring Boot = Spring Framework + Embedded Servers +Embedded Databases - Xml Configuration" Advantages of Using Spring Boot =============================== * It is very easy to develop the Spring Based Application using Java (or) Groovy (or) Kotlin. * It reduces lot of development time and increases Productivity. * It avoids wiriting lots of boilerplate code,Annotations and XML Configuration. * It is very easy to integrate Spring Boot Application with its Spring EcoSystem like Spring Jdbc,Spring ORM,Spring Data,Spring security etc., * It follows "opnionated Default Configuration" approach to reduce developer effort. * It provides Embedded Http Servers like Tomcat,Jetty,undertow, to develop and test our webapplication very easily. * Spring Boot Provides CLI(Command Line Interface) tool inorder to develop and test the application very easily. * It provide supports of various build tools(Maven,Gradle) for developing spring boot application * It provides supports of working with embedded in-memory databases very easily. * By using Spring Boot we can develop the REST API's very easily. * Spring Boot Supports for developing the MicroServices Architecture based Applications. Disadvantages of Spring Boot ============================ * It is very tough and time consuming process to convert existing Spring Application (or) legacy Application into Spring Boot Application. * It is recommended to use for Brand-New Projects. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++