SlideShare a Scribd company logo
Spring Boot
Building a REST Service in minutes
omri.spector@develeap.com
I am…
• Omri Spector, CEO deveLeap
• deveLeap mission
– Helping development teams use the right tools,
technologies & architecture to achieve their business
objective.
– Specialize in Java, CI and the JVM eco-system
• Omri
– Active commercial developer since 1985
– In Java since 2004
– Managed large multi national development groups
omri.spector@develeap.com
Agenda
• What is Spring Boot
• Creating a SpringBoot Application
• Creating a basic REST Service (POST, GET)
• Connecting to a Database
• Going forward
omri.spector@develeap.com
What is Spring boot
• Spring
• Opinionated
• Geared for fast development of robust micro
services
• Others in this arena
– Drop wizard
– Play
– Vert.x
– Jodd
– …
omri.spector@develeap.com
Where would I use SpringBoot?
• Green Field – Get new project up & running in
no time without compromising architecture
and infrastructure
• Modernizing Legacy – Gradually modernize
legacy monolith applications by moving
aspects to Spring Boot “micro-services”
Let’s code
omri.spector@develeap.com
Starting a project
• https://start.spring.io/
– Actuator: “Production Ready”
– Web: Web related functionality (e.g. MVC)
– Devtools: Hot swap during development
– Lombok: “Less boilerplate”
Later we can easily add more, e.g. “data”, “cloud”,…
omri.spector@develeap.com
Alternative start - JHipster
• JHipster is a code generation tool that
offers a much more comprehensive
starting point
• It adds opinioned use of the client side
stack:
Angular, Gulp, SASS, Bower, etc.
• It adds many common features and UI out of the
box
• The amount of code it creates is large – which can
be viewed as good or bad
omri.spector@develeap.com
What we created
• Pom – spring boot pom
• DemoApplication –
– @SpringBootApplication: spring mvc, scanner
– Main: embedded tomcat
• Resources/static, resources/template
• Application.properties (empty)
• DemoApplicationTests – context loads, Spring
test
omri.spector@develeap.com
Build & Run
• Fat Jar for easy deploy
• Actuator endpoints:
– /health,
– /env,
– /metrics,
– :
• Hot swap
omri.spector@develeap.com
Chapter 1 – POST, GET
• Domain: Simplify with lombok
• Services: @Service pojo for all business logic
• Controller: @Controller utilizing:
– @RequestMapping (hierarchical)
– @ResponseBody – to avoid writing views
– @RequestBody & @PathVariable on params
• PostMan – Post, Get, Get non existing
omri.spector@develeap.com
Chapter 2 – HTTP Errors
• Return 404 using RuntimeException with
@ResponseStatus
omri.spector@develeap.com
Chapter 3 – Working with a DB
• Add spring-boot-starter-data-jpa and a db driver
• Add a CrudRepository based @Repository
• Model object is now and @Entity with an @id
– Make sure name matches table name!
• Changed service to use it
• Configuring the db connection in application
properties
omri.spector@develeap.com
Chapter 4 – Getting a list
• Many options, from findAll to HQL to SQL
• We will use Spring Data Proxy
• Of course this is naïve, and is often improved:
– Limiting the fields returned or even defining a “light”
version
– Adding sort and paging
Iterable<Artist> findByNameContaining(String s);
omri.spector@develeap.com
Chapter 5 – It doesn’t stop here
• Spring is a very comprehensive project
• Spring-Boot wraps many of it’s aspects and
integrates many other successful open source
facilities
omri.spector@develeap.com
Typical additions
• Spring Security
• Spring Social – Facebook, Twitter, LinkedIn…
• Spring Cloud – Service discovery, Circuit breakers,
control bus, …
• Schema Management – Liquibase, Flyway
• Front end assets management – Web jars
• Transaction Management
• Spring Data – Both Relational and many NoSQL
And the list goes on…
omri.spector@develeap.com
In Summary
• Spring boot creates an:
– easy to deploy
– executable
– “fat” jar
• Management services out of the box
• In several minutes and very little code we get:
– REST against a db backend
– JPA based ORM
– And the spring power to easily add so much more
omri.spector@develeap.com
Shameless Plug
Are you considering the move to
“micro-services”?
Don’t hesitate to call:
omri.spector@develeap.com
Thank you!
www.develeap.com
Slide Share:
http://www.slideshare.net/omrispector/building-a-rest-service-in-minutes-with-spring-boot

More Related Content

What's hot (20)

PPTX
jQuery
Jay Poojara
 
PPTX
Fetch API Talk
Chiamaka Nwolisa
 
PPTX
Spring boot
Gyanendra Yadav
 
PDF
Intro to GraphQL
Rakuten Group, Inc.
 
PPTX
Spring boot
sdeeg
 
PDF
Angular
Lilia Sfaxi
 
PDF
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw19
 
PDF
Spring Boot
koppenolski
 
PDF
Spring Boot
Pei-Tang Huang
 
PDF
Graphql
Niv Ben David
 
PPTX
Ajax ppt - 32 slides
Smithss25
 
PDF
An Introduction to Redux
NexThoughts Technologies
 
PDF
1. flutter introduccion v2
Felipe Hernandez Palafox
 
PPT
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
PPTX
Introduction to React JS for beginners | Namespace IT
namespaceit
 
PDF
NEXT.JS
Binumon Joseph
 
PDF
Angular - Chapter 3 - Components
WebStackAcademy
 
PDF
Introduction to Redux
Ignacio Martín
 
PPTX
Spring Framework Petclinic sample application
Antoine Rey
 
jQuery
Jay Poojara
 
Fetch API Talk
Chiamaka Nwolisa
 
Spring boot
Gyanendra Yadav
 
Intro to GraphQL
Rakuten Group, Inc.
 
Spring boot
sdeeg
 
Angular
Lilia Sfaxi
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
luisw19
 
Spring Boot
koppenolski
 
Spring Boot
Pei-Tang Huang
 
Graphql
Niv Ben David
 
Ajax ppt - 32 slides
Smithss25
 
An Introduction to Redux
NexThoughts Technologies
 
1. flutter introduccion v2
Felipe Hernandez Palafox
 
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
Introduction to React JS for beginners | Namespace IT
namespaceit
 
Angular - Chapter 3 - Components
WebStackAcademy
 
Introduction to Redux
Ignacio Martín
 
Spring Framework Petclinic sample application
Antoine Rey
 

Viewers also liked (9)

PDF
Spring boot
Bruno Coan
 
PDF
JHipster, modern web application development made easy
Raphaël Brugier
 
PDF
REST with Spring Boot #jqfk
Toshiaki Maki
 
PPTX
Conhecendo API do Facebook
Virtualize Interatividade Digital
 
PDF
Gestao 2.0 para Fundação Dom Cabral
Jose Claudio Terra
 
PDF
Grails 3.0先取り!? Spring Boot入門ハンズオン #jggug_boot
Toshiaki Maki
 
PPTX
Building REST APIs with Spring Boot and Spring Cloud
Kenny Bastani
 
PDF
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
PDF
Microservice With Spring Boot and Spring Cloud
Eberhard Wolff
 
Spring boot
Bruno Coan
 
JHipster, modern web application development made easy
Raphaël Brugier
 
REST with Spring Boot #jqfk
Toshiaki Maki
 
Conhecendo API do Facebook
Virtualize Interatividade Digital
 
Gestao 2.0 para Fundação Dom Cabral
Jose Claudio Terra
 
Grails 3.0先取り!? Spring Boot入門ハンズオン #jggug_boot
Toshiaki Maki
 
Building REST APIs with Spring Boot and Spring Cloud
Kenny Bastani
 
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
Microservice With Spring Boot and Spring Cloud
Eberhard Wolff
 
Ad

Similar to Building a REST Service in minutes with Spring Boot (20)

PPTX
SpringBootCompleteBootcamp.pptx
SUFYAN SATTAR
 
PDF
Spring boot jpa
Hamid Ghorbani
 
PDF
Java SpringBoot Book Build+Your+API+with+Spring.pdf
mewajok782
 
DOCX
Spring interview questions
SkillPracticalEdTech
 
PPTX
Introduction to Spring Boot
Purbarun Chakrabarti
 
PDF
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Matt Raible
 
PDF
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Matt Raible
 
PDF
(eBook PDF) Full Stack Development with JHipster: Build modern web applicatio...
ashyqqc893
 
PDF
Spring Boot
Jaran Flaath
 
PDF
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Matt Raible
 
DOCX
Spring diy projects
SkillPracticalEdTech
 
PPTX
Spring boot Introduction
Jeevesh Pandey
 
PDF
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
PDF
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
PDF
Devoxx : being productive with JHipster
Julien Dubois
 
PDF
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
Appster1
 
PDF
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
Appster1
 
PDF
Spring Boot
Jaydeep Kale
 
PDF
A presentationon SPRING-BOOT and CRUD operation
AbhijiteDebBarman
 
PPT
Spring Boot in Action
Alex Movila
 
SpringBootCompleteBootcamp.pptx
SUFYAN SATTAR
 
Spring boot jpa
Hamid Ghorbani
 
Java SpringBoot Book Build+Your+API+with+Spring.pdf
mewajok782
 
Spring interview questions
SkillPracticalEdTech
 
Introduction to Spring Boot
Purbarun Chakrabarti
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Matt Raible
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Matt Raible
 
(eBook PDF) Full Stack Development with JHipster: Build modern web applicatio...
ashyqqc893
 
Spring Boot
Jaran Flaath
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - South We...
Matt Raible
 
Spring diy projects
SkillPracticalEdTech
 
Spring boot Introduction
Jeevesh Pandey
 
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
Devoxx : being productive with JHipster
Julien Dubois
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
Appster1
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
Appster1
 
Spring Boot
Jaydeep Kale
 
A presentationon SPRING-BOOT and CRUD operation
AbhijiteDebBarman
 
Spring Boot in Action
Alex Movila
 
Ad

Recently uploaded (20)

PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Designing Production-Ready AI Agents
Kunal Rai
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

Building a REST Service in minutes with Spring Boot

  • 1. Spring Boot Building a REST Service in minutes
  • 2. [email protected] I am… • Omri Spector, CEO deveLeap • deveLeap mission – Helping development teams use the right tools, technologies & architecture to achieve their business objective. – Specialize in Java, CI and the JVM eco-system • Omri – Active commercial developer since 1985 – In Java since 2004 – Managed large multi national development groups
  • 3. [email protected] Agenda • What is Spring Boot • Creating a SpringBoot Application • Creating a basic REST Service (POST, GET) • Connecting to a Database • Going forward
  • 4. [email protected] What is Spring boot • Spring • Opinionated • Geared for fast development of robust micro services • Others in this arena – Drop wizard – Play – Vert.x – Jodd – …
  • 5. [email protected] Where would I use SpringBoot? • Green Field – Get new project up & running in no time without compromising architecture and infrastructure • Modernizing Legacy – Gradually modernize legacy monolith applications by moving aspects to Spring Boot “micro-services”
  • 7. [email protected] Starting a project • https://start.spring.io/ – Actuator: “Production Ready” – Web: Web related functionality (e.g. MVC) – Devtools: Hot swap during development – Lombok: “Less boilerplate” Later we can easily add more, e.g. “data”, “cloud”,…
  • 8. [email protected] Alternative start - JHipster • JHipster is a code generation tool that offers a much more comprehensive starting point • It adds opinioned use of the client side stack: Angular, Gulp, SASS, Bower, etc. • It adds many common features and UI out of the box • The amount of code it creates is large – which can be viewed as good or bad
  • 9. [email protected] What we created • Pom – spring boot pom • DemoApplication – – @SpringBootApplication: spring mvc, scanner – Main: embedded tomcat • Resources/static, resources/template • Application.properties (empty) • DemoApplicationTests – context loads, Spring test
  • 10. [email protected] Build & Run • Fat Jar for easy deploy • Actuator endpoints: – /health, – /env, – /metrics, – : • Hot swap
  • 11. [email protected] Chapter 1 – POST, GET • Domain: Simplify with lombok • Services: @Service pojo for all business logic • Controller: @Controller utilizing: – @RequestMapping (hierarchical) – @ResponseBody – to avoid writing views – @RequestBody & @PathVariable on params • PostMan – Post, Get, Get non existing
  • 12. [email protected] Chapter 2 – HTTP Errors • Return 404 using RuntimeException with @ResponseStatus
  • 13. [email protected] Chapter 3 – Working with a DB • Add spring-boot-starter-data-jpa and a db driver • Add a CrudRepository based @Repository • Model object is now and @Entity with an @id – Make sure name matches table name! • Changed service to use it • Configuring the db connection in application properties
  • 14. [email protected] Chapter 4 – Getting a list • Many options, from findAll to HQL to SQL • We will use Spring Data Proxy • Of course this is naïve, and is often improved: – Limiting the fields returned or even defining a “light” version – Adding sort and paging Iterable<Artist> findByNameContaining(String s);
  • 15. [email protected] Chapter 5 – It doesn’t stop here • Spring is a very comprehensive project • Spring-Boot wraps many of it’s aspects and integrates many other successful open source facilities
  • 16. [email protected] Typical additions • Spring Security • Spring Social – Facebook, Twitter, LinkedIn… • Spring Cloud – Service discovery, Circuit breakers, control bus, … • Schema Management – Liquibase, Flyway • Front end assets management – Web jars • Transaction Management • Spring Data – Both Relational and many NoSQL And the list goes on…
  • 17. [email protected] In Summary • Spring boot creates an: – easy to deploy – executable – “fat” jar • Management services out of the box • In several minutes and very little code we get: – REST against a db backend – JPA based ORM – And the spring power to easily add so much more
  • 18. [email protected] Shameless Plug Are you considering the move to “micro-services”? Don’t hesitate to call: [email protected]

Editor's Notes

  • #8: Devtools in IDE – only when running in debug mode. “Mostly” works. Not as fast or total as Jrebel.
  • #10: Tomcat alternatives: jetty, undertow, grizzly, …
  • #11: Note: Fat jar created by maven, not when running from IDE
  • #15: To add paging: - findByNameContaining(String s, Pageable pageable); and pass PageRequest