0% found this document useful (0 votes)
13 views

Api & M unit - 1

The document provides an overview of the Spring Framework, an open-source Java application development framework that simplifies the complexity of enterprise application development. It highlights key features such as dependency injection, modular architecture, and support for various application types including web and mobile applications. Additionally, it discusses the advantages of using Spring, including flexibility, maintainability, and ease of testing.

Uploaded by

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

Api & M unit - 1

The document provides an overview of the Spring Framework, an open-source Java application development framework that simplifies the complexity of enterprise application development. It highlights key features such as dependency injection, modular architecture, and support for various application types including web and mobile applications. Additionally, it discusses the advantages of using Spring, including flexibility, maintainability, and ease of testing.

Uploaded by

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

ApI vM

Unit-| : Spring s basiy

what is Spring Frame work


Jpring is a po pulas open Source Java applicaien
davelopment framwork
(Created by Rod Tohnson)

Jt supports dvelopi wg any Eind ot java opplicah


2-
oppicahony,
Such os tandalone appica hons web
data baje-driven applicotioons Vmo re

wa
3. The basic o bjeci ve of the trame work
dvelopment
t. re da e the Complexiby involved in
of application (enterprite)
applitaion

Sprirg ie not limie d to cntexprife develop


4 But ailable
ment, many proje ct are av undes Spring
-
mobile applicaton, loud- bayed e tc..
Such as

4ram sor k helps in developing a loosely


5. Spring whichore
Couple d appliCahon timple,
aintainle
easitu testable, reUfable k m
abySprin
spring ir evnywhere
A Spring flerible iby anie at deretrpd
rotkd by deyelope vi all oves the world
talGo ha
Contribuioike in tch Com panes
including Amalon, g ogle micyof oft. e t
Jping s Heribl,
(ibrasies
Spri) exteniort and third - pasty
lek develope build any opplicaion
is fast
Sprina
Ststup, fet hutdon s opiiled ereCuhon
Fast
modal
t aio Supporttkacive programnming
foy even greats etfieney
Spring is Secine
in dustry
Mats eosis to inteqrale with
deive truitworthy
tandad Sec iby schemes
Souiond

Ipring it Supporive
the reoources Fromay hime,
find
any where.
Spring VersOns
vev
Spirg x
Spring X

Spring 3
ao0 Sprirg3o

2o06 Spvingzo
2004

Fig Stble vertion o f Sprirg

Kiain features of Spri FFYamwork


Gavaarchive)
relatively Small
igkt -weight : +Spxing Jar
are

Spving Fromworle wiu be


.ßasic
les Hhan to mb

Non -Invasive ? Applicaion deelope d u3ing PoJo

Coupled : Sprirg eatures i lce DI V Aop


Loosely
help in uokely Covple d Co de
applicahon
Tnvei on of Contr o (ToC): It 4te Care of
obje ct ifecycle & dopendencies
Container: TE tate Cae of object c re oio,
Sprirg
initiaizoti on v menaginyobject
deperden cies.
NAPASpe Ct oriente d pro9ramming promoe
Teperahon of fvpporhrg funchond
fuch as vloggi
Vany acion

VSecuri y fom the Co ve of applicaion

Frame woykMoeles

Date A ccen layes


web laye

webmvc

web F Lux t asacho)


cwcb Socket

Cave beans Contert


apectiexpresion

Core SeY vice Los


Test

Spring Hodule groups.


Fig:
he Folo wing key Modle grps
features
h Cove Container - prsvides Cg
Data accen|Lntearohon Sup povH JDBe voPM
data a cces oPproach
webApp.
web -provides Support t. inmp lement
others- Fewother modles ike Teyt

Cort Container

Core
" kay Medle of spring Framewerk
ch aly
" TE provides fundamental Support on whi
other mede are deper dnt

Beans

. IE pro vide s a Baic prirg Container Called


ßean Fa ctory
Conttrt
" Tt þx ovidey one more pring Contaner Colled
Applicahon ConFertiCAc)

The AC prei innheni basic features of Beon


Fachry vao provides a ddihona feat ure
to fup port enterpvife aPp dewe loprnant
expre on longuoge CSPt

object valuey
-Atpect
Afpect OYientk d pregrommi)

rhis mnode helpt in iolati ngcrovi- Cutthg


funchoniby hon busines logic o pplication

nte Accen DntegTaion


Tava Database Connecivi ty CID BC)
I t previdey an abstact layes G Suppost
TPBC Calli to elathonal pß.

nkiect Relahonal Mappig (oPM)


fr popu oRM
, provides integahon upport
foliions Such a HbernaeJPA etc

Tra achon

Simple tronjacion ApL


the
" it pYovide

web

hoy a Cont aines coled web


Thi modle
which in berih basic
Contert
Pplicaion
Applicaion CentcKt Contai nes k
fatures rem
devetop web baed Ap pi
add fe atu res tt
web mvc
provid implemenltion of mvc Cmodal
Conho ler) poltenn t implement Serves Cide
present abon laye
wel
Supports featu xes t implenment REsThul
Servica
webFlux
Stack wit
pring So introd Ce d a reachre
Flry
web ame work Called SpYirg web
to Support Yeachve programmrg Springf web

websoctet

Ufed o 2 wy Comm Unca on bclient


Serven in webS ocket bosed we b App

This modle provides


provide require
Tequire dd fuppoyt
Su b test
Sprirg applicabions.
trameworlc Conhiquring toc Continer
Ufirg Java -baed Goni
Cmid)
,LOC Containeris a fran worlk foy implemtnig
Quomatd dependency injchom
ContoinN object Cre aion

PesPo hibilitiy of Toc Contoiner ave

" Dnstaniahng the be an


" wiring the bt ani tosethey
Configuring the beans
cycle
anaging the bean Enhre life

Spving Ioc
Cortne Create Busine objecs
Read depen den
dependend
Conhgu reion
Metadt

ib inshucio on what
’ The Container
instanhote Conigvre by eadirg
obiec H to
Coniqurahon Metadata.

ConiguYaion Metadate iS repre Jented in


The
CLutoahon oY)Java Co de
Jova
Advantages of LoC

blw diFfeat
fwitch
mabing it eajies ta
Implementabon
Modalaiby of a progrom
3 Greatks

eale in teshrg a progremey


Gre aten

basedConfquration SupporH a
New Java
clanes
Coniqurahon -anno toted
Bean annotated clas

Conhsuraion
public clan Aplicahon
-;Cops
Bean
public ckescs Cuuibmelervice cushreleva

eturn new Cuftomessevvite ():

public Ordes SeyviCe

return neu
atroduchon Dpendonty Injechon in SE (mid)

t if a fundamental aipe ct of Spring Frameuork


Hhrough wbich Spring Cantainey injec
obje cti inb otha abiect or dapendencie

Jti the mnain Fun chonaliy previdod by


Spring oc inveyion of Conhrd)
cnure laose coupling betsean
DI in Sprin9
the closes

DI

SDI

Need for DD
clas I
Suppofe as needi the object of
clanis faidt.
method, then
t opeate a misht eppea! to
be dependont on cla Î, it tof prohlems
it Cauld lead te
be ok, but hence Suck
System foilne ,
incding avoldad
dependenci heed t be
dependencies
Loc Pesolves thet (uch
Spring injec hn CDi) which mat
oith Dependen cy v Peuse.
to tet
he Co de e aie
Dependen y In jechon
stands for Settes Conthuc by
oveyYides the
H ic ueed t
propenby
injechon
Iis a paihal
ned initanc
Create
T doesnt
injected usig Setter metho
Depeodencies a re
lic clas Employee AJdres
pub

public sting ahy


Cmployee Add res Cstring Ciby) f
pubic
this ci ycityi

yStands fo CorstoCby dipendeniy injechm


’Dtdoesnot overrides the Selles propty
CpI ha ho pabanjechon.
Co) Cre ate neinytonCes
- Dependncic are injected usi na Canstructr
methods
public clan Enmployee Addres
pub c shirg ciby
public hing get ciby )f
return cibyi

public void l ciby Cst ingcily)

3
3
of autmahcally
t refe t. Copabiibg
lenin9 Spring Component,
dislevenirg and cgi f
sConingwort
Biet ovesvie of how a uto

Compbnnt Sconning
Component anning
a
) Spring provides onnotaion
Centain
Mechonilm with

annoohon ufed foY thi


he primay Spe cialire
Component and its
purpole is
vari ni,Gke Oservice
Repository
Con trolls

A Base pacta ge Coniguiaion


To nable Componnt Scanning we Ipecb

Lase pa ckage
n Sprig pplicatan
pComporsntScon (boare packnge "Com
3. Annetahon driven Confgurahon

Anrotahg claes with Compons nt


Compo nent
public clar My Corm ponsn

XmL Conhgur

alio enable Corpo ne nt JCening


Confis
Can >'element
Conponntf
< Contexti
we USe
iu
in x mL Coni9
SCan bare-package
ponent
c Conteti Com

tdte
helpr
Sprirj
Auto SCannirg in E Config
unt of Code
the amo

Registahon inihaized,itrcony
pximg Contoney is the
when S to lanes with
the Specihed paccases mahcatly
it aut
annotHo ns. omponent
Sfere olype
Tegisler there danes
Le
mating them
featu
Spring
Containers
provides 2 y Pe of Containe
Spring
: Bean factr
& Applica-hon Cantcxt

(: Boan Facty
Sprirg Conhaines with
)Dtisthe basic
to intenti ale| Cantigure &, Monoge
feahre
bean
Spring fameworkbeans Fachry.Beon
an
oY
facbn
intesta Ce repejenre
iS the main
Bean Eachry Conta nes

AppiCotion Gantex-

Sprirg fame work modle bpic:


Rafes
mattes
4 wri te
Contert.Applicahanenkect
oY3 Spxirg fameork
repregenhhg
is the mnain in stace
Applicatin antrtContai hes

C* Interoaliaton, Validahian

y Tt is the pre ferred Contoney for Spirg


applicaion deebpet
antages of Construchr injecho
are set in Constructar;
| immutablei once dapendencis
mokes
hey Cont be changed. it
clan, predi ctable,
2. cleax initbaiato

Dependencies are erplicHy declared mating


is requined for clan
it cas what

Fasies teshrg :
3
teting, as dependencies
unit
Cî Simplihes
moceed
art

dvantages of Seter injecho


A
Heribii y
as dependeneies Can
8I alltows tleribilihy
changed at runtime.
be
den cies
2 opiord Depen
threugh Setter Can be
dependen cis le Cion. eren
tun
Opiona the lay Con
provido d
ndeneJ ae not
Some dpen.
3. Defalt vaues
for dapendoncies
default valus
SI pro vide
Can be helph
which

You might also like