0% found this document useful (0 votes)
139 views32 pages

Internship

The document discusses Spring Boot and React JS. It provides an introduction to Spring Framework and Spring Boot, explaining that Spring Boot makes it easier to use Spring. It covers key Spring concepts like beans, dependency injection, and request mapping. It also discusses Spring Boot features, Spring MVC, Spring data access with JPA, and tools for Spring Boot development like Thymeleaf.

Uploaded by

Khushbu Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views32 pages

Internship

The document discusses Spring Boot and React JS. It provides an introduction to Spring Framework and Spring Boot, explaining that Spring Boot makes it easier to use Spring. It covers key Spring concepts like beans, dependency injection, and request mapping. It also discusses Spring Boot features, Spring MVC, Spring data access with JPA, and tools for Spring Boot development like Thymeleaf.

Uploaded by

Khushbu Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

SPRING-BOOT AND REACT JS

Submitted To: Submitted By:


Miss Shubhangi Chaturvedi Khushbu Garg
Asst. professor, CSE Roll no.:16ECACS019

Department of Computer Science Engineering,


Chartered Institute of Technology, Abu Road
2019-2020
CONTENT
• Introduction
• History
• SPRING BEAN & REQUEST MAPPING
• Dependency Injection
• MAVEN
• Dependency Management
• Default Directory Structure
• Basic Object-Relational Mapping
• SPRING FRAMEWORK
• SPRING MODULES
• PROJECT(ATOM)
• SPRING BOOT
• SPRING BOOT FEATURES
• SPRING MVC
• SPRING MVC Request Flow
• Spring Boot Project
• Spring Boot development tools Department of Computer Science Engineering,
• Thymeleaf Chartered Institute of Technology, Abu Road
• JPA (Java Persistence Language) 2019-2020
• Project
• conclusion
INTRODUCTION

• Spring Framework is the “glue” that put various parts


of an application together.
• Spring Boot is kind of a “packaging” of Spring to
make it easier to use.
• Understand three basic things about Spring: beans,
dependency injection, andof Technology,
requestAbu Road mapping.
Department of Computer Science Engineering,
Chartered Institute
2019-2020
HISTORY
In October 2002, Rod Johnson wrote a book titled Expert
One-on-One J2EE Design and Development. In the book
he proposed a simpler solution based on ordinary java
classes (POJO – plain old java objects) and dependency
Injection.
Juergen Hoeller and Yann Caroff persuaded Rod Johnson
to create an open source project based on the infrastructure
code. Rod, Juergen and Yann started collaborating on the
project around February 2003. It was Yann who coined the
name "spring" for the new framework.

Department of Computer Science Engineering,


Chartered Institute of Technology, Abu Road
2019-2020
SPRING BEAN & REQUEST MAPPING
• Any class annotated with {@Component, @Controller,
(@Rest Controller), @Repository, @Service} is called a
spring bean.
@RequestMapping
• Map a request to a controller method.
• value is the URL or URL pattern.
• method is the request method, e.g. GET,
POST, etc.

Department of Electrical Engineering, CIT


Abu Road
Dependency Injection
• Dependency here means an object relying on another object (i.e. not the
library dependency in Maven).
• DI is a software development technique
• DI helps the interaction between classes, but at the same time keeps the
classes independent.
• There are three types of classes in DI:
 A Service is a
 The Client is a class that uses dependency.
 The Injector
 @Autowired – by type (default)
 @PersistenceContext – a special annotation that injects an entity manager

Department of Electrical Engineering, CIT


Abu Road
MAVEN
• A build tool for Java
 Preprocessing, compilation, packaging, deployment

• Maven Coordinates
 groupId
Name of the company, organization, team etc.,
usually using the reverse URL naming convention
 artifactId
A unique name for the project under groupId
version packaging, default: jar classifier
Department of Electrical Engineering, CIT
Abu Road
Dependency Management
• A dependency of a project is a library that the
project depends on.
• Adding a dependency to a project is as simple
as adding the coordinates of the library to
pom.xml.
• Maven automatically downloads the library
from an online repository and store it locally
for future use.

Department of Electrical Engineering, CIT


Abu Road
Default Directory Structure
• src/main/java
• src/main/resources for files that should be
placed under classpath
• src/main/webapp for web applications
• src/test/java
• target

Department of Electrical Engineering, CIT


Abu Road
Basic Object-Relational Mapping
• Class-level annotations:
@Entity and @Table
• Id field:
@Id and @GeneratedValue
• Fields of simple types:
• @Basic (can be omitted) and @Column
• Fields of class types:
@ManyToOne, @OneToMany, @ManyToMany, and
@OneToOne.
Note:-
Hibernate: An Object-Relational Mapping (ORM) library that
implements the Java Persistence API (JPA).
Department of Electrical Engineering, CIT
Abu Road
SPRING FRAMEWORK
• A popular and stable java application framework for the enterprise development.
• A primary purpose is to reduce dependencies and even introduce negative
dependencies.
• Different from almost every other framework.
• 139 packages.
• Spring is a lightweight framework. It can be thought of as a framework of
frameworks because it provides support to various frameworks such as Struts,
Hibernate, Tapestry, EJB, JSF etc.
• Advantages of spring framework:
 Predefined Templates
 Loose Coupling
  Easy to test
 Lightweight
 Fast Development
 Powerful abstraction
 Declarative support
SPRING MODULES

Very loosely, coupled, components widely usable and separately packaged.


PROJECT(ATOM)

Department of Electrical Engineering, CIT


Abu Road
PROJECT

Department of Electrical Engineering, CIT


Abu Road
SPRING BOOT
• It is a Spring module which provides RAD (Rapid Application
Development) feature to Spring framework.
• It is used to create stand alone spring based application that you can
just run because it needs very little spring configuration.
• Spring Boot does not generate code and there is absolutely no
requirement for XML configuration.
• To create a new Spring Boot application followings are Prerequisites:
 Java 1.8+
 Spring STS / Eclipse with Spring Tool Suite
 Maven - A tool that you can use for building and managing any Java-
based project.

Department of Electrical Engineering, CIT


Abu Road
SPRING BOOT FEATURES
• Web Development
• Spring Application
• Application events and listeners
• Admin features
• Externalized Configuration
• Properties Files
• YAML Support
• Type-safe Configuration
• Logging
• Security
Department of Electrical Engineering, CIT
Abu Road
SPRING MVC
• The Spring Web MVC framework provides
(MVC) architecture and ready components that
can be used to develop flexible and loosely
coupled web applications.
• The MVC pattern results in separating the
different aspects of the application (input logic,
business logic, and UI logic).
• Model: The part that manages the data.
• View: The part that creates the user interface
and screens.
• Controller: The part that handles interactions
between the user, the user interface, and the
data. 
SPRING MVC Request Flow
Spring Boot Project
There are multiple approaches to create Spring Boot
project. We can use any of the following approach to
create application.
• Spring Maven Project
• Spring Starter Project Wizard
• Spring Initializr
• Spring Boot CLI

Department of Electrical Engineering, CIT


Abu Road
e.g.: SPRING MAVEN PROJECT

 Select project type.

Department of Electrical Engineering, CIT


Abu Road
e.g.: SPRING MAVEN PROJECT
 Click on next button.

Department of Electrical Engineering, CIT


Abu Road
e.g.: SPRING MAVEN PROJECT
 Configure project by providing project name.

Department of Electrical Engineering, CIT


Abu Road
e.g.: SPRING MAVEN PROJECT
 After clicking finish, Spring boot project has been created. 

Department of Electrical Engineering, CIT


Abu Road
Spring Boot development tools
 
• Spring Boot development tools make the application
development process simpler. Projects will include the
developer tools if the dependency is added to the Maven
pom.xml file.
• Development tools are disabled when you create a fully-
packed production version of your application.
• The application is automatically restarted when you
make changes to your project's class path files.

Department of Electrical Engineering, CIT


Abu Road
Thymeleaf
 It is a server side Java template engine for web application. It's
main goal is to bring elegant natural templates to your web
application.
 It can be integrate with Spring Framework and ideal for HTML5
Java web applications.
 In the following example, we are using Thymeleaf as our HTML
template and rendering it from controller.
 In order to use Thymeleaf we must add it into our pom.xml file
like:

<dependency>  
        <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-thymeleaf</artifactId>  
</dependency>  
JPA
(Java Persistence Language)
• JPA is just a specification that facilitates
object-relational mapping to manage
relational data in Java applications. 
• It provides a platform to work directly with
objects instead of using SQL statements.
• JPA has spawned many compatible tools and
frameworks; Hibernate is just one of them.
• Today, Hibernate ORM is one of the most
mature JPA implementations, and still a
popular option for ORM in Java.
PROJECT

Department of Electrical Engineering, CIT


Abu Road
PROJECT

Department of Electrical Engineering, CIT


Abu Road
PROJECT

Department of Electrical Engineering, CIT


Abu Road
CONCLUSION
 As a programmer, one needs to be aware what is
going behind the scenes and focus on the business
aspect of the project because managing and
monitoring are already taken care of. Unless there is a
specific need, tweaking the project structure provided
by Spring Boot is almost unnecessary. Perhaps,
programming cannot be simpler than this.

Department of Electrical Engineering, CIT


Abu Road
 

Department of Electrical Engineering, CIT


Abu Road
THANKYOU

Department of Electrical Engineering, CIT


Abu Road

You might also like