SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
Spring Boot
© copyright : spiraltrain@gmail.com
Course Schedule
2
• What is Spring Boot?
• Advantages Spring Boot
• Goal of Spring Boot
• Spring Boot Flavors
• Key Spring Boot Components
• Spring Boot Starter
• Starter Dependencies
• Spring Boot Autoconfigurator
• @SpringBootApplication
• Spring Boot CLI
• Spring Boot Internals
• Spring Boot Actuator
• Reflection
• Annotations
• Spring Core
• Aspect Orientation
• Groovy
• Spring Boot
www.spiraltrain.nl
What is Spring Boot?
• Spring Boot is completely new project from Spring Team :
• Framework developed on top of existing Spring Framework
• Spring Boot uses new model to make Java Development easy :
• Avoids some tedious development steps and boilerplate code and configuration
• Provides defaults for code and annotation configuration
• Follows Opinionated Defaults Configuration Approach
• Spring Boot Framework is not implemented from scratch :
• Rather it is implemented on top of existing Spring Framework
• Used to solve same problems like Spring Framework
3
Spring
Boot
Spring
Framework
Embedded
HTTP Servers
(Tomcat, Jetty)
XML<bean>
Configuration
or
@Configuration
= + -
Spring Boot
www.spiraltrain.nl
Advantages Spring Boot
• Easy to develop Spring Based applications with Java or Groovy :
• Reduces development time and increases productivity
• Avoids writing lots of boilerplate Code :
• Annotations and XML Configuration.
• Easy to integrate Spring Boot Applications with Spring Ecosystem :
• Like Spring JDBC, Spring ORM, Spring Data, Spring Security etc.
• Provides Embedded HTTP servers like Tomcat, Jetty etc. :
• Allows develop and test web applications very easily
• Provides CLI Command Line Interface tool :
• Allows develop and test Spring Boot Applications from command prompt easily
• Provides lots of plugins :
• Allows develop and test Spring Boot Applications easily using Maven and Gradle
• Allows working with embedded and in-memory Databases easily
4Spring Boot
www.spiraltrain.nl
Goal of Spring Boot
• Main goal of Spring Boot is to reduce Development time :
• Unit Test and Integration Test time
• Ease the development of Production ready web applications
• Spring Boot features that accomplish this :
• Avoid XML Configuration completely
• Avoid defining more Annotation Configuration :
• Combines existing Spring Framework Annotations to simple and single Annotation
• Avoid writing lots of import statements
• Provide some defaults to quick start new projects within no time
• Provide Opinionated Development approach
• Limitations of Spring Boot :
• Time consuming to convert Spring Framework projects into Spring Boot Applications
• However it is easy to create brand new/Greenfield Projects using Spring Boot
• Three approaches to start opiniated development :
• Spring Boot CLI Tool, Spring STS IDE, Spring Initializr Website
5Spring Boot
www.spiraltrain.nl
Spring Boot Flavors
• Two flavors of Spring-Based Applications using Spring Boot :
• Java-Based Applications and Groovy Applications
• Spring Boot Groovy Applications :
• Spring Boot CLI or Spring STS IDE or Spring Initializr Website
• Spring Initializr Website is found at: http://start.spring.io/
• Spring Boot Java Applications :
• Spring STS IDE or Spring Initializr Website
• Groovy is also JVM language almost similar to Java Language :
• Can combine both Groovy and Java into one Project
• Groovy files are finally compiled into *.class files with same byte code format
6
Java
*.java
Compiler
javac of groovyc
*.class files
Byte Code
Groovy
*.groovy
Spring Boot
www.spiraltrain.nl
Key Spring Boot Components
• Spring Boot Framework has mainly four major Components :
• Spring Boot Starters
• Spring Boot AutoConfigurator
• Spring Boot CLI
• Spring Boot Actuator
• In addition there are two more Spring Boot components :
• Spring Initilizr and Spring Boot IDEs
• Use Spring Initializr web interface at http://start.spring.io :
• To quick start new Spring Boot projects
7
CLI
Actuator
Autoconfigurator
Starter
Spring Boot
Components
Spring Boot
www.spiraltrain.nl
Spring Boot Starter
• Combines group of related dependencies in single dependency
• Example for Spring WebApplication with Tomcat WebServer :
• Need minimal jar dependencies in your Maven’s pom.xml :
• Spring core Jar file spring-core-xx.jar, Spring Web Jar file spring-web-xx.jar
• Spring Web MVC Jar file spring-webmvc-xx.jar ,Servlet Jar file servlet-xx.jar
• Need to add database related jars to add some database stuff :
• Spring JDBC Jar file spring-jdbc-xx.jar, Spring ORM Jar files spring-orm-xx.jar
• Spring Transaction Jar file spring-transaction-xx.jar
• Need to define lot of dependencies in build files :
• Very tedious and cumbersome tasks and also it increases our build file size
• Solution is to use Spring Boot Starter component :
• Spring Boot Starter component combines all related jars into single jar file
• We need to add one and only one jar file spring-boot-starter-web.jar file
• When adding spring-boot-starter-web.jar file dependency :
• Spring Boot downloads all required jars and adds them to project classpath
8Spring Boot
www.spiraltrain.nl
Starter Dependencies
• spring-boot-starter-logging jar file :
• Loads all it’s dependency jars to project classpath like :
• jcl-over-slf4j, jul-to-slf4j,log4j-over-slf4j, logback-classic
9
spring-boot-starter-web
spring-boot-starter
spring-web
spring-webmvc
spring-boot-starter-tomcat
spring-boot
spring-boot-autoconfigure
spring-boot-starter-logging
Tomcat-embed-core
Tomcat-embed-logging- juli
Spring Boot
www.spiraltrain.nl
Spring Boot AutoConfigurator
• Most of the Spring IO Platform Critics :
• Spring-based application requires lot of configuration either with XML or annotations
• Solution to this problem is Spring Boot AutoConfigurator :
• Don’t need to define XML configuration and almost no Annotation configuration
• Spring Boot AutoConfigurator component will take care of providing this information
• Spring MVC application using Spring IO Platform :
• Define lot of XML Configuration like views, view resolvers etc
• If using spring-boot-starter-web jar file in project build file :
• Spring Boot AutoConfigurator will resolve views, view resolvers etc. automatically
• Also Spring Boot reduces Annotation configuration :
• If we use @SpringBootApplication annotation at class level
• Spring Boot AutoConfigurator automatically adds required annotations to Java ByteCode
• Spring Boot Starter reduces build’s dependencies :
• Spring Boot AutoConfigurator reduces the Spring Configuration
• Spring Boot Starter triggers Spring Boot AutoConfigurator automatically
10Spring Boot
www.spiraltrain.nl
@SpringBootApplication
• Definition for @SpringBootApplication :
@Target(value=TYPE)
@Retention(value=RUNTIME)
@Documented
@Inherited
@Configuration
@EnableAutoConfiguration
@ComponentScan
public @interface SpringBootApplication
11
SpringBootApplication @Configuration @ComponentScan @EnableAutoConfiguration= + +
Spring Boot
www.spiraltrain.nl
Spring Boot CLI
• Spring Boot Command Line Interface :
• Spring Boot software to run and test Spring Boot applications from command line
• When running Spring Boot Applications through CLI :
• Internally uses Spring Boot Starter and Spring Boot AutoConfigurate components
• Spring Boot CLI introduced spring command :
• Execute Groovy Scripts from command prompt
spring run HelloWorld.groovy
• Can run Spring Web Applications with simple Spring Boot CLI Commands
• Spring Boot Framework internally uses Groovy :
• Add some defaults like Default import statements, Application main() method etc.
• Groovy language contains JAR Dependency Resolver :
• Resolves and add all required jar files to Groovy Project classpath
• Groovy Compiler groovyc :
• Will automatically add all default import statements then compile it
12Spring Boot
www.spiraltrain.nl
Spring Boot Internals
• Spring Boot Framework Programming model :
• Mainly inspired by Groovy Programming model
• Spring Boot Framework depends on two major components :
• Groovy and Grape
• Grape is an Embedded Dependency Resolution engine :
• JAR Dependency Manager embedded into Groovy
• Adds maven dependencies to project classpath to reduce build file definitions
13
Spring Boot
Groovy
Groovy’s Grape
Spring Boot
www.spiraltrain.nl
Spring Boot Actuator
• Spring Boot Actuator components major features are :
• Providing Management EndPoints to Spring Boot Applications.
• Spring Boot Applications Metrics
• For Spring Boot Web Application using CLI :
• Spring Boot Actuator provides hostname localhost and default port number 8080
• Application is accessed with http://localhost:8080/ end point
• Most common endpoints Boot provides out of the box :
• /health – Shows application health information
• /info – Displays arbitrary application info
• /metrics – Shows ‘metrics’ information for the current application
• /trace – Displays trace information by default the last few HTTP requests
• In order to get it working :
• Actuator requires Spring MVC to expose its endpoints through HTTP
• No other technology is supported
14Spring Boot
© copyright : spiraltrain@gmail.com
Summary : Spring Boot
• Spring Boot uses new model to make Java Development easy :
• Avoids some tedious development steps and boilerplate code and configuration
• Provides defaults for code and annotation configuration
• Follows Opinionated Defaults Configuration Approach
• Three approaches to start opiniated development :
• Spring Boot CLI Tool, Spring STS IDE, Spring Initializr Website
• Two flavors of Spring-Based Applications using Spring Boot :
• Java-Based Applications and Groovy Applications
• Spring Boot Framework has mainly four major Components :
• Spring Boot Starters, Spring Boot AutoConfigurator, Spring Boot CLI, Spring Boot Actuator
• Spring Boot Starters :
• Combines group of related dependencies in single dependency
• Spring Boot Framework depends on two major components :
• Groovy and Grape
Spring Intro 15
Exercises
Spring Boot

Contenu connexe

Tendances

Tendances (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 

Similaire à Spring Boot

Springboot - A milestone framework in Java Development
Springboot - A milestone framework in Java DevelopmentSpringboot - A milestone framework in Java Development
Springboot - A milestone framework in Java DevelopmentExpeed Software
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your developmentStrannik_2013
 
"Spring Boot. Boot up your development" Сергей Моренец
"Spring Boot. Boot up your development" Сергей Моренец"Spring Boot. Boot up your development" Сергей Моренец
"Spring Boot. Boot up your development" Сергей МоренецFwdays
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Strannik_2013
 
Module 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to beginModule 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to beginDeepakprasad838637
 
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)🎤 Hanno Embregts 🎸
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocketMing-Ying Wu
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 
Deep dive into share point framework webparts
Deep dive into share point framework webpartsDeep dive into share point framework webparts
Deep dive into share point framework webpartsPrabhu Nehru
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbStaples
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbStaples
 
Bootify your spring application
Bootify your spring applicationBootify your spring application
Bootify your spring applicationJimmy Lu
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples Yochay Kiriaty
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Slobodan Lohja
 

Similaire à Spring Boot (20)

Springboot - A milestone framework in Java Development
Springboot - A milestone framework in Java DevelopmentSpringboot - A milestone framework in Java Development
Springboot - A milestone framework in Java Development
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your development
 
"Spring Boot. Boot up your development" Сергей Моренец
"Spring Boot. Boot up your development" Сергей Моренец"Spring Boot. Boot up your development" Сергей Моренец
"Spring Boot. Boot up your development" Сергей Моренец
 
SpringBoot
SpringBootSpringBoot
SpringBoot
 
Spring boot wednesday
Spring boot wednesdaySpring boot wednesday
Spring boot wednesday
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
 
Module 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to beginModule 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to begin
 
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
 
Booting up with polymer
Booting up with polymerBooting up with polymer
Booting up with polymer
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 
Deep dive into share point framework webparts
Deep dive into share point framework webpartsDeep dive into share point framework webparts
Deep dive into share point framework webparts
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo db
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo db
 
Bootify your spring application
Bootify your spring applicationBootify your spring application
Bootify your spring application
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
 
Spring
SpringSpring
Spring
 
Selenium Topic 2 IDE
Selenium Topic 2 IDESelenium Topic 2 IDE
Selenium Topic 2 IDE
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 

Plus de koppenolski

Plus de koppenolski (8)

Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
HTML Intro
HTML IntroHTML Intro
HTML Intro
 
Wicket Intro
Wicket IntroWicket Intro
Wicket Intro
 
R Intro
R IntroR Intro
R Intro
 
Python Intro
Python IntroPython Intro
Python Intro
 
SQL Intro
SQL IntroSQL Intro
SQL Intro
 
UML Intro
UML IntroUML Intro
UML Intro
 
Intro apache
Intro apacheIntro apache
Intro apache
 

Dernier

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 

Dernier (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Spring Boot

  • 2. © copyright : spiraltrain@gmail.com Course Schedule 2 • What is Spring Boot? • Advantages Spring Boot • Goal of Spring Boot • Spring Boot Flavors • Key Spring Boot Components • Spring Boot Starter • Starter Dependencies • Spring Boot Autoconfigurator • @SpringBootApplication • Spring Boot CLI • Spring Boot Internals • Spring Boot Actuator • Reflection • Annotations • Spring Core • Aspect Orientation • Groovy • Spring Boot
  • 3. www.spiraltrain.nl What is Spring Boot? • Spring Boot is completely new project from Spring Team : • Framework developed on top of existing Spring Framework • Spring Boot uses new model to make Java Development easy : • Avoids some tedious development steps and boilerplate code and configuration • Provides defaults for code and annotation configuration • Follows Opinionated Defaults Configuration Approach • Spring Boot Framework is not implemented from scratch : • Rather it is implemented on top of existing Spring Framework • Used to solve same problems like Spring Framework 3 Spring Boot Spring Framework Embedded HTTP Servers (Tomcat, Jetty) XML<bean> Configuration or @Configuration = + - Spring Boot
  • 4. www.spiraltrain.nl Advantages Spring Boot • Easy to develop Spring Based applications with Java or Groovy : • Reduces development time and increases productivity • Avoids writing lots of boilerplate Code : • Annotations and XML Configuration. • Easy to integrate Spring Boot Applications with Spring Ecosystem : • Like Spring JDBC, Spring ORM, Spring Data, Spring Security etc. • Provides Embedded HTTP servers like Tomcat, Jetty etc. : • Allows develop and test web applications very easily • Provides CLI Command Line Interface tool : • Allows develop and test Spring Boot Applications from command prompt easily • Provides lots of plugins : • Allows develop and test Spring Boot Applications easily using Maven and Gradle • Allows working with embedded and in-memory Databases easily 4Spring Boot
  • 5. www.spiraltrain.nl Goal of Spring Boot • Main goal of Spring Boot is to reduce Development time : • Unit Test and Integration Test time • Ease the development of Production ready web applications • Spring Boot features that accomplish this : • Avoid XML Configuration completely • Avoid defining more Annotation Configuration : • Combines existing Spring Framework Annotations to simple and single Annotation • Avoid writing lots of import statements • Provide some defaults to quick start new projects within no time • Provide Opinionated Development approach • Limitations of Spring Boot : • Time consuming to convert Spring Framework projects into Spring Boot Applications • However it is easy to create brand new/Greenfield Projects using Spring Boot • Three approaches to start opiniated development : • Spring Boot CLI Tool, Spring STS IDE, Spring Initializr Website 5Spring Boot
  • 6. www.spiraltrain.nl Spring Boot Flavors • Two flavors of Spring-Based Applications using Spring Boot : • Java-Based Applications and Groovy Applications • Spring Boot Groovy Applications : • Spring Boot CLI or Spring STS IDE or Spring Initializr Website • Spring Initializr Website is found at: http://start.spring.io/ • Spring Boot Java Applications : • Spring STS IDE or Spring Initializr Website • Groovy is also JVM language almost similar to Java Language : • Can combine both Groovy and Java into one Project • Groovy files are finally compiled into *.class files with same byte code format 6 Java *.java Compiler javac of groovyc *.class files Byte Code Groovy *.groovy Spring Boot
  • 7. www.spiraltrain.nl Key Spring Boot Components • Spring Boot Framework has mainly four major Components : • Spring Boot Starters • Spring Boot AutoConfigurator • Spring Boot CLI • Spring Boot Actuator • In addition there are two more Spring Boot components : • Spring Initilizr and Spring Boot IDEs • Use Spring Initializr web interface at http://start.spring.io : • To quick start new Spring Boot projects 7 CLI Actuator Autoconfigurator Starter Spring Boot Components Spring Boot
  • 8. www.spiraltrain.nl Spring Boot Starter • Combines group of related dependencies in single dependency • Example for Spring WebApplication with Tomcat WebServer : • Need minimal jar dependencies in your Maven’s pom.xml : • Spring core Jar file spring-core-xx.jar, Spring Web Jar file spring-web-xx.jar • Spring Web MVC Jar file spring-webmvc-xx.jar ,Servlet Jar file servlet-xx.jar • Need to add database related jars to add some database stuff : • Spring JDBC Jar file spring-jdbc-xx.jar, Spring ORM Jar files spring-orm-xx.jar • Spring Transaction Jar file spring-transaction-xx.jar • Need to define lot of dependencies in build files : • Very tedious and cumbersome tasks and also it increases our build file size • Solution is to use Spring Boot Starter component : • Spring Boot Starter component combines all related jars into single jar file • We need to add one and only one jar file spring-boot-starter-web.jar file • When adding spring-boot-starter-web.jar file dependency : • Spring Boot downloads all required jars and adds them to project classpath 8Spring Boot
  • 9. www.spiraltrain.nl Starter Dependencies • spring-boot-starter-logging jar file : • Loads all it’s dependency jars to project classpath like : • jcl-over-slf4j, jul-to-slf4j,log4j-over-slf4j, logback-classic 9 spring-boot-starter-web spring-boot-starter spring-web spring-webmvc spring-boot-starter-tomcat spring-boot spring-boot-autoconfigure spring-boot-starter-logging Tomcat-embed-core Tomcat-embed-logging- juli Spring Boot
  • 10. www.spiraltrain.nl Spring Boot AutoConfigurator • Most of the Spring IO Platform Critics : • Spring-based application requires lot of configuration either with XML or annotations • Solution to this problem is Spring Boot AutoConfigurator : • Don’t need to define XML configuration and almost no Annotation configuration • Spring Boot AutoConfigurator component will take care of providing this information • Spring MVC application using Spring IO Platform : • Define lot of XML Configuration like views, view resolvers etc • If using spring-boot-starter-web jar file in project build file : • Spring Boot AutoConfigurator will resolve views, view resolvers etc. automatically • Also Spring Boot reduces Annotation configuration : • If we use @SpringBootApplication annotation at class level • Spring Boot AutoConfigurator automatically adds required annotations to Java ByteCode • Spring Boot Starter reduces build’s dependencies : • Spring Boot AutoConfigurator reduces the Spring Configuration • Spring Boot Starter triggers Spring Boot AutoConfigurator automatically 10Spring Boot
  • 11. www.spiraltrain.nl @SpringBootApplication • Definition for @SpringBootApplication : @Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @Configuration @EnableAutoConfiguration @ComponentScan public @interface SpringBootApplication 11 SpringBootApplication @Configuration @ComponentScan @EnableAutoConfiguration= + + Spring Boot
  • 12. www.spiraltrain.nl Spring Boot CLI • Spring Boot Command Line Interface : • Spring Boot software to run and test Spring Boot applications from command line • When running Spring Boot Applications through CLI : • Internally uses Spring Boot Starter and Spring Boot AutoConfigurate components • Spring Boot CLI introduced spring command : • Execute Groovy Scripts from command prompt spring run HelloWorld.groovy • Can run Spring Web Applications with simple Spring Boot CLI Commands • Spring Boot Framework internally uses Groovy : • Add some defaults like Default import statements, Application main() method etc. • Groovy language contains JAR Dependency Resolver : • Resolves and add all required jar files to Groovy Project classpath • Groovy Compiler groovyc : • Will automatically add all default import statements then compile it 12Spring Boot
  • 13. www.spiraltrain.nl Spring Boot Internals • Spring Boot Framework Programming model : • Mainly inspired by Groovy Programming model • Spring Boot Framework depends on two major components : • Groovy and Grape • Grape is an Embedded Dependency Resolution engine : • JAR Dependency Manager embedded into Groovy • Adds maven dependencies to project classpath to reduce build file definitions 13 Spring Boot Groovy Groovy’s Grape Spring Boot
  • 14. www.spiraltrain.nl Spring Boot Actuator • Spring Boot Actuator components major features are : • Providing Management EndPoints to Spring Boot Applications. • Spring Boot Applications Metrics • For Spring Boot Web Application using CLI : • Spring Boot Actuator provides hostname localhost and default port number 8080 • Application is accessed with http://localhost:8080/ end point • Most common endpoints Boot provides out of the box : • /health – Shows application health information • /info – Displays arbitrary application info • /metrics – Shows ‘metrics’ information for the current application • /trace – Displays trace information by default the last few HTTP requests • In order to get it working : • Actuator requires Spring MVC to expose its endpoints through HTTP • No other technology is supported 14Spring Boot
  • 15. © copyright : spiraltrain@gmail.com Summary : Spring Boot • Spring Boot uses new model to make Java Development easy : • Avoids some tedious development steps and boilerplate code and configuration • Provides defaults for code and annotation configuration • Follows Opinionated Defaults Configuration Approach • Three approaches to start opiniated development : • Spring Boot CLI Tool, Spring STS IDE, Spring Initializr Website • Two flavors of Spring-Based Applications using Spring Boot : • Java-Based Applications and Groovy Applications • Spring Boot Framework has mainly four major Components : • Spring Boot Starters, Spring Boot AutoConfigurator, Spring Boot CLI, Spring Boot Actuator • Spring Boot Starters : • Combines group of related dependencies in single dependency • Spring Boot Framework depends on two major components : • Groovy and Grape Spring Intro 15 Exercises Spring Boot