Introduction to spring boot

Santosh Kumar Kar
Santosh Kumar KarJava Architect having 11 years experience in Java/JEE;Micro Services; um Techolution
Santosh Kumar Kar,
Lead Software Engineer, EPAM
skkar.2k2@gmail.com
Before we start
A task for you – time 15 minutes
Develop a web application which reads Employee information from
MySQL DB and print on the screen. You need to use Spring and
Hibenate(JPA). It should run in any web container.
List out the challenges you have faced while setting up the env.
1) Download and set up a server (e.g. Tomcat)
2) Download and install a DB
3) Download required Spring jars
4) Download Hibernate jar compatible with the Spring version
5) Download jar for MySQL driver
6) Setting up web.xml to use spring MVC
7) Anything I left ???
Before we start
Why Spring Boot
• Provides a radically faster and widely accessible ‘getting started’
experience for all Spring development
• No clumsy XML Configuration by developers
• Provide opinionated ‘starter’ POMs to simplify your Maven
configuration
• Uses project management tool such as MAVEN or GRADLE
• Helps fast development and production ready code
• Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR
files)
• In memory DB
Documentation
http://docs.spring.io/spring-boot/docs/current/reference/html/index.html
System Requirement Spring Boot 1.4.2.RELEASE
• Apache Maven
• Java 7 +
http://start.spring.io – a good starting point
Folder Structure to be followed
Understanding pom.xml
Build runnable jar
First Java Program for spring boot
Running the application
> mvn spring-boot:run
Devtools
• Automatic Restart
• LiveReload
• Remote Debug Tunneling
• Remote Update and Restart
Details at:
http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html
Spring Tool Suite (sts)
Download https://spring.io/tools/sts/all
Spring Web & MVC
application.properties
pom.xml
Without application.properties
Runnable war
1) In Main java file:
1.1 extend : org.springframework.boot.web.support.SpringBootServletInitializer
1.2 override the method:
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyApplication.class);
}
1.3 No need of main() method.
2) In pom.xml
1.1 Change the packing to war as:
<packaging>war</packaging>
3) Use command: mvn clean package
4) In target, rename the war<context root> as you want, deploy in tomcat and access with <context root>/<request mapping>
MySQL & jdbc
pom.xml
spring.datasource.jndi-name=java:jboss/datasources/customers - For JNDI Datasource
MySQL & jdbc
JPA in Spring Boot
JPA in Spring Boot
JPA in Spring Boot
JPA in Spring Boot
Things to learn:
Only interface is enough which inherits to CrudRepository. The implementation will be provided by spring.
To know the other inherited methods, please go through the CrudRepository API.
JPA in Spring Boot
Code
https://github.com/santoshkar/SpringBoot.git
The code can be downloaded from:
Send to skkar.2k2@gmail.com
Questions ???
1 von 26

Recomendados

Spring Boot von
Spring BootSpring Boot
Spring BootHongSeong Jeon
3.9K views41 Folien
Introduction to Spring Framework von
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
26K views52 Folien
Spring boot von
Spring bootSpring boot
Spring bootsdeeg
26.6K views25 Folien
Spring boot von
Spring bootSpring boot
Spring bootGyanendra Yadav
1.9K views32 Folien
Spring Boot von
Spring BootSpring Boot
Spring Bootkoppenolski
365 views15 Folien
Spring Boot in Action von
Spring Boot in Action Spring Boot in Action
Spring Boot in Action Alex Movila
3K views55 Folien

Más contenido relacionado

Was ist angesagt?

Spring Boot Tutorial von
Spring Boot TutorialSpring Boot Tutorial
Spring Boot TutorialNaphachara Rattanawilai
7.8K views29 Folien
Introduction to Spring Boot! von
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
6.4K views28 Folien
Introduction to ASP.NET Core von
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET CoreAvanade Nederland
3.8K views38 Folien
Xke spring boot von
Xke spring bootXke spring boot
Xke spring bootsourabh aggarwal
1.3K views20 Folien
Spring Framework - Core von
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
34.8K views117 Folien
Spring - Part 1 - IoC, Di and Beans von
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Hitesh-Java
1.3K views36 Folien

Was ist angesagt?(20)

Spring - Part 1 - IoC, Di and Beans von Hitesh-Java
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
Hitesh-Java1.3K views
PUC SE Day 2019 - SpringBoot von Josué Neis
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
Josué Neis701 views
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T... von Edureka!
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Spring Interview Questions and Answers | Spring Tutorial | Spring Framework T...
Edureka!1.7K views
Angular 8 von Sunil OS
Angular 8 Angular 8
Angular 8
Sunil OS531K views
Introduction to Java Programming Language von jaimefrozr
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr26.2K views

Destacado

Microservices with Java, Spring Boot and Spring Cloud von
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudEberhard Wolff
14.9K views65 Folien
SpringMVC von
SpringMVCSpringMVC
SpringMVCAkio Katayama
2.9K views55 Folien
Skillwise-Spring framework 1 von
Skillwise-Spring framework 1Skillwise-Spring framework 1
Skillwise-Spring framework 1Skillwise Group
923 views31 Folien
Spring Data Jpa von
Spring Data JpaSpring Data Jpa
Spring Data JpaIvan Queiroz
926 views38 Folien
REST API Best (Recommended) Practices von
REST API Best (Recommended) PracticesREST API Best (Recommended) Practices
REST API Best (Recommended) PracticesRasheed Waraich
582 views50 Folien
Design & Development of Web Applications using SpringMVC von
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Naresh Chintalcheru
12.8K views36 Folien

Destacado(20)

Microservices with Java, Spring Boot and Spring Cloud von Eberhard Wolff
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff14.9K views
REST API Best (Recommended) Practices von Rasheed Waraich
REST API Best (Recommended) PracticesREST API Best (Recommended) Practices
REST API Best (Recommended) Practices
Rasheed Waraich582 views
Design & Development of Web Applications using SpringMVC von Naresh Chintalcheru
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
Naresh Chintalcheru12.8K views
Spring User Group Thymeleaf 08-21-2013 von Justin Munn
Spring User Group Thymeleaf 08-21-2013Spring User Group Thymeleaf 08-21-2013
Spring User Group Thymeleaf 08-21-2013
Justin Munn1.8K views
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf von Tim Donohue
DSpace UI Prototype Challenge: Spring Boot + ThymeleafDSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
Tim Donohue1.4K views
Introducing thymeleaf von eiryu
Introducing thymeleafIntroducing thymeleaf
Introducing thymeleaf
eiryu1.1K views
Modern Java web applications with Spring Boot and Thymeleaf von LAY Leangsros
Modern Java web applications with Spring Boot and ThymeleafModern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and Thymeleaf
LAY Leangsros886 views
Spring IO '15 - Developing microservices, Spring Boot or Grails? von Fátima Casaú Pérez
Spring IO '15 - Developing microservices, Spring Boot or Grails?Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf von Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Thymeleaf14.3K views

Similar a Introduction to spring boot

Spring competitive tests von
Spring competitive testsSpring competitive tests
Spring competitive testsSkillPracticalEdTech
6 views1 Folie
Building a Spring Boot Application - Ask the Audience! von
Building a Spring Boot Application - Ask the Audience!Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!🎤 Hanno Embregts 🎸
917 views21 Folien
How to use_cucumber_rest-assured_api_framework von
How to use_cucumber_rest-assured_api_frameworkHow to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_frameworkHarshad Ingle
27 views6 Folien
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot» von
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
770 views22 Folien
Spring Live Sample Chapter von
Spring Live Sample ChapterSpring Live Sample Chapter
Spring Live Sample ChapterSyed Shahul
430 views45 Folien

Similar a Introduction to spring boot(20)

How to use_cucumber_rest-assured_api_framework von Harshad Ingle
How to use_cucumber_rest-assured_api_frameworkHow to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_framework
Harshad Ingle27 views
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot» von DataArt
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
DataArt770 views
Spring Live Sample Chapter von Syed Shahul
Spring Live Sample ChapterSpring Live Sample Chapter
Spring Live Sample Chapter
Syed Shahul430 views
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018) von 🎤 Hanno Embregts 🎸
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 JavaLand 2017) von 🎤 Hanno Embregts 🎸
Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)Building a Spring Boot Application - Ask the Audience!  (from JavaLand 2017)
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
Bootify your spring application von Jimmy Lu
Bootify your spring applicationBootify your spring application
Bootify your spring application
Jimmy Lu8.3K views
Spring Boot & Actuators von VMware Tanzu
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & Actuators
VMware Tanzu4.6K views
Spring Boot Whirlwind Tour von VMware Tanzu
Spring Boot Whirlwind TourSpring Boot Whirlwind Tour
Spring Boot Whirlwind Tour
VMware Tanzu464 views
Spring hibernate tutorial von Rohit Jagtap
Spring hibernate tutorialSpring hibernate tutorial
Spring hibernate tutorial
Rohit Jagtap798 views
Maven: Managing Software Projects for Repeatable Results von Steve Keener
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
Steve Keener708 views
Spring Performance Gains von VMware Tanzu
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
VMware Tanzu2.3K views

Más de Santosh Kumar Kar

Smart home arduino von
Smart home   arduinoSmart home   arduino
Smart home arduinoSantosh Kumar Kar
878 views32 Folien
Operating electrical devices with PIR sensor. No coding, No controller von
Operating electrical devices with PIR sensor. No coding, No controllerOperating electrical devices with PIR sensor. No coding, No controller
Operating electrical devices with PIR sensor. No coding, No controllerSantosh Kumar Kar
2.5K views20 Folien
Temperature sensor with raspberry pi von
Temperature sensor with raspberry piTemperature sensor with raspberry pi
Temperature sensor with raspberry piSantosh Kumar Kar
1.4K views34 Folien
Pir motion sensor with raspberry pi von
Pir motion sensor with raspberry piPir motion sensor with raspberry pi
Pir motion sensor with raspberry piSantosh Kumar Kar
1.8K views21 Folien
Angular js for Beginnners von
Angular js for BeginnnersAngular js for Beginnners
Angular js for BeginnnersSantosh Kumar Kar
181 views59 Folien
Raspberry pi complete setup von
Raspberry pi complete setupRaspberry pi complete setup
Raspberry pi complete setupSantosh Kumar Kar
1.5K views21 Folien

Último

MercerJesse3.0.pdf von
MercerJesse3.0.pdfMercerJesse3.0.pdf
MercerJesse3.0.pdfjessemercerail
163 views6 Folien
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab... von
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...RAHUL PAL
43 views26 Folien
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption... von
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...BC Chew
38 views47 Folien
NodeJS and ExpressJS.pdf von
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdfArthyR3
50 views17 Folien
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdf von
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdfSTRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdf
STRATEGIC MANAGEMENT MODULE 1_UNIT1 _UNIT2.pdfDr Vijay Vishwakarma
134 views68 Folien

Último(20)

Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab... von RAHUL PAL
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
Research Methodology (M. Pharm, IIIrd Sem.)_UNIT_IV_CPCSEA Guidelines for Lab...
RAHUL PAL43 views
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption... von BC Chew
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...
Artificial Intelligence and The Sustainable Development Goals (SDGs) Adoption...
BC Chew38 views
NodeJS and ExpressJS.pdf von ArthyR3
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdf
ArthyR350 views
ANGULARJS.pdf von ArthyR3
ANGULARJS.pdfANGULARJS.pdf
ANGULARJS.pdf
ArthyR352 views
12.5.23 Poverty and Precarity.pptx von mary850239
12.5.23 Poverty and Precarity.pptx12.5.23 Poverty and Precarity.pptx
12.5.23 Poverty and Precarity.pptx
mary850239514 views
Pharmaceutical Analysis PPT (BP 102T) von yakshpharmacy009
Pharmaceutical Analysis PPT (BP 102T) Pharmaceutical Analysis PPT (BP 102T)
Pharmaceutical Analysis PPT (BP 102T)
yakshpharmacy009116 views
GSoC 2024 .pdf von ShabNaz2
GSoC 2024 .pdfGSoC 2024 .pdf
GSoC 2024 .pdf
ShabNaz242 views
Presentation_NC_Future now 2006.pdf von Lora
Presentation_NC_Future now 2006.pdfPresentation_NC_Future now 2006.pdf
Presentation_NC_Future now 2006.pdf
Lora 37 views
The Future of Micro-credentials: Is Small Really Beautiful? von Mark Brown
The Future of Micro-credentials:  Is Small Really Beautiful?The Future of Micro-credentials:  Is Small Really Beautiful?
The Future of Micro-credentials: Is Small Really Beautiful?
Mark Brown102 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE... von Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
Peripheral artery diseases by Dr. Garvit.pptx von garvitnanecha
Peripheral artery diseases by Dr. Garvit.pptxPeripheral artery diseases by Dr. Garvit.pptx
Peripheral artery diseases by Dr. Garvit.pptx
garvitnanecha124 views
What is Digital Transformation? von Mark Brown
What is Digital Transformation?What is Digital Transformation?
What is Digital Transformation?
Mark Brown41 views

Introduction to spring boot