SlideShare a Scribd company logo
Introduction to
Spring-Boot with CRUD
Operations
Building a Simple RESTful API
Abhijite Deb Barman
Id : 2002029
1
Agenda
 What is Spring Boot ?
 It’s features
 What is CRUD ?
 Flow Architecture
 Setting Up a Spring Boot Project
 Creating Packages
 Implementing CRUD modules
 Testing CRUD Operations
Q & A Session
 Conclusion
2
Introduction of Spring Boot
• Spring Boot is an open-source Java-based framework for building
standalone, production-grade Spring applications.
Original Author: Rod Johnson
Developer: VMware
Initial Release: April 2014
Stable Release: 3.2.5(18 April 2024)
Written in: JAVA
Platform: JAVA Enterprise Edition
3
Features
4
Features
• Dependency Injection
-Dependency( external library ) injection in Spring Boot simplifies codes by
handling the management and provision of the necessary components.
• MVC(Model View Controller)
-Model : It's responsible for managing the application's data, including tasks like
retrieving data from a database, processing it, and updating it.
-View: The View receives data from the Model and displays it in a user-friendly
format.
-Controller: The Controller acts as an intermediary between the Model and the
View.
5
Features
• Auto-configuration:
• -It refers to the automatic setup of application components and
infrastructure based on the dependencies and configuration present
in the project
• Spring Security
• - Spring Security is a powerful authentication and authorization
framework for securing Java applications, particularly those built
using the Spring
6
Benefits of Using Spring Boot
• Efficiency: Minimizes boilerplate code and configuration.
• Rapid Development: Quickly prototype and develop applications.
• Convention Over Configuration: Reduces manual setup and
configuration.
• Production-Ready: Includes features for monitoring, security, and
more.
• Community and Support: Active community and extensive
documentation.
7
CRUD
• CRUD stands for Create, Read, Update, and Delete. It represents the
basic operations that can be performed on data in a database.
• Key Points:
• Create: Adding new records to the database.
• Read: Retrieving existing records from the database.
• Update: Modifying existing records in the database.
• Delete: Removing records from the database.
8
Architecture
9
Responsibility of Controller
10
 Receive incoming HTTP requests from clients.
 Process requests by invoking appropriate business logic.
 Return HTTP responses, typically in the form of JSON, XML, or
HTML, depending on the client's request.
Responsibility of Service
11
.
Implement and encapsulate business rules and logic.
Control transaction boundaries for operations that involve multiple
database interactions.
 Convert data between different formats or representations as required
by the application.
Responsibility of Model
12
 Define data entities.
 Encapsulate data and behavior.
 Define attributes and relationships.
 Implement validation logic.
 Create Data Transfer Objects (DTOs).
Spring initializr (www.start.spring.io)
13
Dependencies
• Dependency : A dependency refers to an external library or module that your
application relies on to provide certain functionality.
• 1.Spring Web(build applications using Spring MVC)
-module within the Spring Framework
-provides support for building web applications
• 2.Spring Data JPA (Persist data in SQL stores with java Persistence API using Spring
Data)
-provides a higher-level abstraction over JPA
-simplifying common data access tasks
14
Dependencies
• 3.Thymeleaf( Allows HTML to be correctly displayed in browsers and as static
prototypes)
-helps create the visual part of a web application
-insert dynamic data from the backend
• 4.MySql Driver(MySQL JDBC driver )
- Makes a connection between java app and MYSQL database)
• 5.Lombok(java annotation library which helps to reduce boilerplate)
- Lombok eliminates the need to write repetitive code
such as getters, setters, constructors etc.
15
Dependencies
• 6.Spring Boot Dev Tools
- provide fast application restarts, Live Reload, and configurations for
enhanced development experience
16
Demo Application
17
18
19
Database Connection
20
spring.application.name=demo
spring.datasource.url=jdbc:mysql://localhost:3306/formdatabse
spring.datasource.username=root
spring.datasource.password=abhijite
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
Create Four Packages under src/mian/java
21
22
Create class & interface under these packages
23
24
Model Package
25
 Create a Java class
 Annotated with @Entity
 Declare Table name
 Declare column with datatypes
 Declare Getter and Setter Method
 Set primary-key with @Id
 Set table name with @Table(name=“table_name”)
Model class
26
Repository Package
27
 Create an interface
 Annotated with @Repository
 Extends JpaRepository< , >
 Takes two Parameters
 Model Java class name and primary key datatype
Repository Interface
28
Service Package
29
 Create an interface
 Annotated with @Service
 Create abstract function
 Create a Java class
 Implements with service class
 Implements those abstract function
Service Interface
30
Service Class
31
Controller Package
32
 Create a Java class
 Annotated with @Controller
 Annotated by @Autowired with repository
 Marks a constructor, field, setter method, or config method as to
be autowired by Spring's dependency injection facilities.
33
34
35
36
37
Model class
38
READ
39
CREATE
40
41
42
CREATE
43
44
45
CREATE
46
47
48
CREATE
49
UPDATE
50
51
52
UPDATE
53
54
55
56
UPDATE
57
DELETE
58
58
59
60
61
Q & A Session
62
References
1. https://www.javatpoint.com/
2. https://spring.io/projects/spring-boot
3. https://www.w3schools.blog/spring-boot-tutorial
63
Resource
• Project : https://github.com/abhijite-bd/Springboot/
64
THANK YOU
65

More Related Content

Similar to A presentationon SPRING-BOOT and CRUD operation (20)

PPTX
Spring boot Introduction
Jeevesh Pandey
 
PPTX
Beige_Pastel_Minimalist_Thesis_Defense_Presentation_(3)[1].pptx
21981a05i0
 
PPTX
Spring (1)
Aneega
 
PPTX
SoftwareUniversity seminar fast REST Api with Spring
Nayden Gochev
 
PDF
exploring-spring-boot-clients.pdf Spring Boot
baumi3
 
DOCX
Spring interview questions
SkillPracticalEdTech
 
PDF
Toms introtospring mvc
Guo Albert
 
DOCX
Spring diy projects
SkillPracticalEdTech
 
PDF
Spring 2
Aruvi Thottlan
 
PPTX
Spring tutorials
TIB Academy
 
PPTX
Skillwise-Spring framework 1
Skillwise Group
 
PDF
Spring in Action - Sixth Edition (MEAP V04) Craig Walls
elonaolzakmx
 
PPTX
Spring framework Introduction
Anuj Singh Rajput
 
PDF
Devoxx : being productive with JHipster
Julien Dubois
 
PPTX
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 
PPT
Hybernat and structs, spring classes in mumbai
Vibrant Technologies & Computers
 
PPTX
Spring
Suman Behara
 
PDF
PDF Spring in Action - Sixth Edition (MEAP V04) Craig Walls download
leasheyressi
 
PDF
Spring Start Here Learn What You Need And Learn It Well 1st Edition Laurentiu...
wktamhyv6089
 
PDF
Ajug - The Spring Update
Gunnar Hillert
 
Spring boot Introduction
Jeevesh Pandey
 
Beige_Pastel_Minimalist_Thesis_Defense_Presentation_(3)[1].pptx
21981a05i0
 
Spring (1)
Aneega
 
SoftwareUniversity seminar fast REST Api with Spring
Nayden Gochev
 
exploring-spring-boot-clients.pdf Spring Boot
baumi3
 
Spring interview questions
SkillPracticalEdTech
 
Toms introtospring mvc
Guo Albert
 
Spring diy projects
SkillPracticalEdTech
 
Spring 2
Aruvi Thottlan
 
Spring tutorials
TIB Academy
 
Skillwise-Spring framework 1
Skillwise Group
 
Spring in Action - Sixth Edition (MEAP V04) Craig Walls
elonaolzakmx
 
Spring framework Introduction
Anuj Singh Rajput
 
Devoxx : being productive with JHipster
Julien Dubois
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 
Hybernat and structs, spring classes in mumbai
Vibrant Technologies & Computers
 
Spring
Suman Behara
 
PDF Spring in Action - Sixth Edition (MEAP V04) Craig Walls download
leasheyressi
 
Spring Start Here Learn What You Need And Learn It Well 1st Edition Laurentiu...
wktamhyv6089
 
Ajug - The Spring Update
Gunnar Hillert
 

Recently uploaded (20)

PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PPTX
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
PDF
Digital water marking system project report
Kamal Acharya
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PPTX
仿制LethbridgeOffer加拿大莱斯桥大学毕业证范本,Lethbridge成绩单
Taqyea
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PDF
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
PDF
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PDF
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
PPTX
darshai cross section and river section analysis
muk7971
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
PPTX
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
Digital water marking system project report
Kamal Acharya
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
仿制LethbridgeOffer加拿大莱斯桥大学毕业证范本,Lethbridge成绩单
Taqyea
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
darshai cross section and river section analysis
muk7971
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
Ad

A presentationon SPRING-BOOT and CRUD operation