Screenshot from 2024-05-28 16-46-45 (30 files merged).ppt

imjdabhinawpandey 6 views 30 slides May 28, 2024
Slide 1
Slide 1 of 30
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30

About This Presentation

it is the ppt about spring framework


Slide Content

SPRINGFRAMEWORKTUTORIAL

AGENDA
1.Overview
2.Spring 10 Platform
3.Spring Framework
4.Environment Setup
5.Inversion of Control
6.Dependency injection
7.SpringWeb MVC
Framework 8.Spring Security

OVERVIEW
Springisthemostpopularapplicationdevelopmentframeworkforenterprise
Java.MillionsofdevelopersaroundtheworlduseSpringFrameworkto
createhighperforming,easilytestable,reusablecode.
October 2002 The first version was released
June 2003The framework was first released under the Apache 2.0 license March
2004 The first milestone release -1.0
October 2006 Spring2.0
November 2007 Spring2.5
December 2009 Spring3.0
December 2011 Spring3.1

BENEFITS
•Spring enables developersto develop enterprise-class applications using
POJOs.
•Spring is organized in a modular fashion.
•Spring does not reinvent thewheelinstead,it truly makes useof some of
the existing technologies.
•Testingan applicationwritten with Springis simple because environment
dependent code is moved into this framework.
•Spring's webframework is a well-designed web MVC framework.
•Lightweight loC containerstend to be lightweight,especially when
compared to EJB containers.
•Spring provides a consistent transaction management.

SPRING10PLATFORM
-
--
-- 00.A
RelM! O .,I No"RP l . it•on;il

SPRING10PLATFORM·CORE
Spring
Framework
Provides core support for dependency
injection,transaction management,web apps,
data access,messaging and more.
Spring
Security
Protects your application with
comprehensive and extensible
authentication and authorization support.
Groovy Brings high-productivity dynamic
language features to the JVM.
Reactor A foundation for reactive fast data
applications on the JVM.

SPRING10PLATFORM·DATA
Spring 10 addresses modern data landscape -whether it
be document,graph,key-value,relational,or simply
unstructured files.

SPRING10PLATFORM·WORKLOADS
IntegrationChannels,Adapters,Filters,Transformers
Batch Jobs,Steps,Readers,Writers
Bigdata Ingestion,Export,Orchestration,Hadoop
Web Controllers,REST,WebSocket

SPRINGFRAMEWORK
Spring is the most popular application development framework
for enterprise Java.
The core features of the Spring Framework can be used in
developing any Java application, but there are extensions for
buildingweb applications on top of the Java EE platform.
Springenables you to build applications from "plainold Java
objects" (POJOs) and to apply enterprise services non-
invasively to POJOs. This capability applies to the Java SE
programming model and to full and partial Java EE.

SPRINGFRAMEWORK·COMPONENTS
SpringFratnllWOllcRuntime
DataAccess/Integration Web
( JDBC)B
RB
(---=:-!
L : : _ j0
(
. .)
Tranaec:tlone L . : : : _ j
L..:::_j
( AOP )(Aepecte)(lnetrumentatk>n)
CoreContainer
( Beans )( Core )(Conxt
)
=="
(
)

SPRINGFRAMEWORK·CORECONTAINER
•The Core module provides the fundamental parts of the framework,
includingthe loC and Dependency Injectionfeatures.
•The Bean module provides BeanFactory which is a sophisticated
implementation of thefactory pattern.
•The Context module builds on the solid base provided by the Core
and Beans modules and it is a mediumto access any objects
defined and configured.
•The Expression Language module provides a powerful expression
language for querying and manipulatingan object graph at runtime.

SPRINGFRAMEWORK·DATAACCESS
•The JDBC module provides a JDBC-abstraction layerthat removes
the need to do tedious JDBC related coding.
•The ORM module provides integration layers for popular object
relational mappingAPls,including JPA,JDO,Hibernate,and iBatis.
•The OXM module provides an abstraction layer that supports
Object/XML mapping implementations for JAXB, Castor,XMLBeans,
JiBX and XStream.
•The Java MessagingService JMS module contains features for
producingand consuming messages.
•The Transaction modulesupports programmatic and declarative
transactionmanagement for classes that implement special
interfaces andforall your POJOs.

SPRINGFRAMEWORK·WEB
•Spring's Web module provides basic web-oriented integration features such as
multipart file-upload functionality andthe initialization of the loC containerusingservlet
listeners and aweb-oriented application context.
•The Web-Servlet module contains Spring's model-view-cont roller (MVC)
implementation forweb applications. Spring's MVC framework provides a clean
separation between domainmodelcode andweb forms,and integrates withall the other
features of the SpringFramework.
•The Web-Portlet module provides the MVC implementation to be used in a portlet
environment and mirrors the functionality of Web-Serv iet module.
•The Web-Struts module contains the support classes for integratinga classic Struts
web tierwithina Springapplication.

ENVIRONMENTSETUP

ECLIPSE
•Download Eclipse from http://www.eclipse.org/downloads
•Decompress downloaded file into the directory of your
choice (e.g."C:\Eclipse" on Windows)
• ???
•PROFIT!!!

MAVENINTEGRATIONFORECLIPSE
•Open Eclipse
•Go to Help -> Eclipse Marketplace
•Search by Maven
•Click "Install" button at "Maven Integration for Eclipse"
section
•Follow the instruction step by step

HELLOWORLD
httRs://github.com/soaserele/sRring-tutorial/tree/master/hello

INVERSIONOFCONTROL
Inversion of control (loC) is a programming technique inwhich
object coupling is bound at runtime by an assembler object
and is typically not known at compiletime using static
analysis.In order for the assembler to bind objects to one
another,the objects must possess compatible abstractions.
•is a concept in application development
•"don't call me,I'll call you"
•one form is Dependency Injection (DI)

INVERSIONOFCONTROL
Objects(POJOs)
produces
Fully
configured system
Ready for
Use
Your
Business
The Spring
Container
Configuration
Metadata

INVERSIONOFCONTROL
The Springcontainer is at the core of the Spring Framework.
The Springcontainer uses dependency injection (DI) to
manage the components that make upan application.
Thecontainerwillcreatetheobjects,wirethemtogether,
configurethem,andmanagetheircompletelifecyclefrom
creationtilldestruction.
The container gets its instructions onwhat objects to
instantiate,configure,and assemble by readingconfiguration
metadata provided.The configuration metadata can be
represented either by XML, Java annotations, or Java code.

DEPENDENCYINJECTIONCONTAINERS
•Spring BeanFactory Container
This is the simplest container providing basic support for DI.There are
a number of implementations of the BeanFactory interface that
come supplied straight out-of-the-box with Spring.The most
commonly used BeanFactory implementation is the XmlBeanFactory
class.
•SpringApplicationContext Container
The ApplicationContext includes all functionality of the BeanFactory,it
is generally recommended overthe BeanFactory.It adds more
enterprisespecific functionality such as the ability to resolve textual
messages from a properties file andthe ability to publish application
events to interested event listeners.

CONTAINERSEXAMPLE
htt12s://github.com/soaserele/s12ring-tutorial/tree/master/beanfactocv.

BEANS

BEANS
The objects that form the backbone of your application and
that are managed by the Spring loC container are called
beans.
A bean is an object that is instantiated,assembled,and
otherwise managed by a Spring loC container.These beans
are created with the configuration metadata that you supply to
the container,for example,in the form of XML <bean/>
definitions which you have already seen in previous chapters.

BEANS·DEFINITION
The bean definition containsthe information called
configuration metadata which is needed for the container
to know the followings:
•How to create a bean
•Bean's lifecycle details
•Bean's dependencies

BEANS·DEFINITION
<>
Property Description
class* The bean class to be used to create the
bean.
name The unique bean identifier.
scope The scope of the objects created from a
particular bean definition.
autowiring Used to specify autowire mode for a bean
mode definition
lazy- Tells the loC container to create a bean
IllMade with Sldes.com initializationinstance when it is first requested,rather

Property
BEANS·DEFINITION
Description
constructor
arg
Used to inject the dependencies into
the class througha class constructor
properties Used to inject the dependencies into
the class throughsetter methods
,,...

Property
BEANS·DEFINITION
Description
initialization
method
A callback to becalledjust after all
necessary properties on the bean have
been set by the container.
destruction
method
A callback to be used when the
container containing the bean is
destroyed.
,,...

BEANDEFINITIONEXAMPLE
htt12s://github.com/soaserele/s12ring-tutorial/tree/master/beandef
,,...

BEANS·SCOPES
Scope Description
singleton Thisscopesthebeandefinitiontoasingle
instanceperSpringloCcontainer(default).
prototypeThis scopes a single bean definition to have
any number of object instances.
request* ThisscopesabeandefinitiontoanHTTP
request.
session* ThisscopesabeandefinitiontoanHTTP
.
session.
IIMadewithSldes.com global- ThisscopesabeandefinitiontoaglobalHTTP
<>
Tags