0% found this document useful (0 votes)
0 views22 pages

Unit-5 Oop by Coreconcepts - Engineering

The document discusses various concepts related to Spring framework, including building RESTful web services, handling requests and responses, and utilizing annotations for configuration. It covers core engineering principles, component management, and the use of WebSockets for real-time communication. Additionally, it highlights the importance of bean scopes and lifecycle management in application development.

Uploaded by

kushikha303
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)
0 views22 pages

Unit-5 Oop by Coreconcepts - Engineering

The document discusses various concepts related to Spring framework, including building RESTful web services, handling requests and responses, and utilizing annotations for configuration. It covers core engineering principles, component management, and the use of WebSockets for real-time communication. Additionally, it highlights the importance of bean scopes and lifecycle management in application development.

Uploaded by

kushikha303
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/ 22

UNIT- 5

QOP
GBung stameuoxk o- Shulg Coxe Baaics - sung
beban
Dhan dacy Tnacti on comtsp ci, Spng ui ueuIoi
Comtal, A0P, Buam scopei - sgloton, Ro tatyoe,
Requeit , Sussien, Apitation , web Jocket, Auto
Amnotati on Lte le cal baks
B.aan Conjuatton tles
spunig Boat i- shirg Bcat Bueid systens,
SAing Boat ode stsutwe Sarg Boot Runnes,
B UTLDING RESTFUL. wEB SERVIC CS, Rest
Logg
tortollex , Kqult mappng , Reguut Bo dy
Requst paametu
19 uild tueb
ueb
, GET, PosT, 'PUT, DELETE API},
abplicattons
Coreconcepts: engineering
Bousexful, ligktuegat, mcl open
BOGe. JauQ ameuuOsek useol

toal ttat helps Vaua dulopeea


It ates anel manaqes obycts fo you (sa yoe
clon '?t
t haus to tueete.
tuelte nel

Imaguie you ane build'ng a caH


athout spuuig - You
You buelol' the engie, eheale,
body - uenythg by youre ey.
lth spwig - You tell shung I nd a cas!
t bsunás all the' pavta omal tommecti
Comm
Co jaua Coreconcepts: engineering
@Compom et
pubi lass Cau
Atouniad

pubeto uoid dsuiue (J


engtne. staxt C);
sennng"J,
System. out- puñthh (" Cax is
GCompont d cuate bhlans
Atouuucd sto
ing Tnuwuion Contal -

Tueon Cort meone guigthe


cHOatton an
and. lepndany
lap
nan agenert the Spsng faeins.
objucts mat coate
Cseatei ond wiecti
manually uatng
then
auctomatica ll
Toc -helbu ch makuig docle doosey coubl
to mauto
TOC Corctauer to mahage
the e ycle. amd alahhdesce
Comnon Ioc Contanni ae
Beantactosiyy and
Applicaon Conte ct
kaq punde behnd the

Bean Factby)
IOC
(TOL lontani
App Lecaton
tonte
AOP Acbeet ~ Qseieneol Pseo g4crmig
Asbuct
wsut ComCom noh logfe (liks
toms Co ti ong) h 6ne
sepating
class
Called a CHOSS

Thfs Common
Cwttlng Concerm
de, tead wmtig ogsg
fau m e t h o o

Cocle u
asßot
t eheneue nedd.

class uhea you


Asfact a
ui Coreconcepts:
OCommoh Coole engineering
the
place
Jaei paunt actual Coole that
thot JU&
Cah
spsug te
Aoluice butlol abbs cthat

O Tt Relbs ou to manage
molllas aduite
OThee bfse the mehaol
Ruuns mettoo.
t) Bejaxa Runs atn
the
the n
Oncd ofter

Asoend

{AOP Jo
Po lnt
Befoo

Aclueee
all mthod
ttaget
Coole Example i
Asþact
Component
pualis cass Logaingfpact
Beae ("execetion (* My Sexuice . * C..)))
publ'e uafd logByore C)
System.o ut. inth l" metthod callud |":
Coreconcepts: engineering

omponent
Class mySeu'e
pubtic uoid dooaxk t)
("woxtng
systm out. centb
3
Bean sees -
i- eyle and
deteymines
Beatn scopes the
natonces .
B.Qan Soþes

iul Sesion
apAicotion (Singletoy
vi) wb soee
web
S O k e t

Buototype
Bean

seulon
Coreconcepts: engineering
fos the ertiu shung Cotaui .
Atl eqescts Ahasc. cthe ame, beah us tote
Exampi

wnitonee i cHateol duesy tis


the bean Heq ueyti.
Each objat ui edaperdet nudi thun
txample cue ?- uheh each
ohjuct i not shaad.
Unlike sungdton , tu blah
Us e l hen each

QComponet
Class myyBsan
puhdic
Syto ut pintho (" neu potrtyee
BLO Ceected"J;
Coreconcepts: engineering
) Requa t: neue bea nitahce
Requst scopa
ope man
the
dìcavvdid qti the
tutb appdatiod, enlt
eb anate baan dtonce.
ogcust fnihes.
asrams

Contalls
htanotically
uct, o huan

Psuuote RaqustB.aan eaussLoan i


GGatmapar'g ("/ ses" nap tha URL
public, stuing handls (3 (aquethian)
tielol Systen. out puitn
suqturt 3
diteted
Shuug

Coreconcepts: engineering
(ç) qsesen baon dance

ophlieotion!
Long
Log out).
wab alicati on.
whh uuant to sta n
gou
p u cdata
Cat
Fame Coee
coe the Raquut
1 Li ke
Cortaer
pu.tie clas mgy Coveballes
WAtto uwid
puivate SsonBan Sesaonß ean:

puble ssng shouu C3{


Syadm out pitn (sesOn Bea)

Coreconcepts: engineering

bean wsta
i Cueat1c fonsu the eentie ueb aþpþlicat on
On shad, acHOS.g ale nd sesi ons
One sharal unstonce fon al usls
Sumila Sengltn but shecgio to t k
to Sengleto,
aphlitationa
ude data

Atouned

Gtmathng
puhie stiiy
sctg, shou (Jy
Cytin out heitln (appbcan)
3
3
( ) Oeb Sockot .
WebSoket a Comm ncation bsotocol that
puoulu full - dluj laa ctuw -uy) comunca
tion bdteeen a. clect mal.
a inle , ong connection.
) Once lonmected ; both liend an R e
JUCeiue dota at aåay tÉn,.
ui ch oni gamu. afpliatt
Code
Const Sotket = neu WebSocket Cws || eMampe 'J'
I/ uhen Comneon o
So ket. onop en =C)=>3
Consoleog Lcometed to seuen
Socket "senc HellLo seen ']
|l when messag e scelo
Socket- 0mesage = (euet)

3: Coreconcepts: engineering
/ whn connection closes
Soket a, On cli se = J =>
Cors ale- Jog ('onmecon closed':
Ih shat
J1-) ent Connets(neu
Q-) SaLUY accets Comet on webcockat C...J)7
3) mMag
e ex changed ovoþen.
4) ConnechoÓ hd olose
niuct th ot
auutamati taly njecb blpunclnt hekns
cto gat
Spung ouctomatitaly uolties th cosuct
htan ancd assigns t to ctha 'auud uild.
OThe most Lomnon annotation Ws1d os

Onutoucd Can be appted to feldi, catu -


mthools
Tt anks 6y type by
seasches fo a bea, of th mathikg cas tyfe.

no matohng uis gawd, sperig theous


ncaption unus
an fneption
Qrctoutsud (suuid
Can cali onblquity mltpe matehug
baans se to sesadu
shu cotau,
Annatotions -Coreconcepts: engineering
Amnoto ton wh
Contigunation and. cgjnie conmponekti dlepanduc
O Thy uplace vaditoral xmL -bas ed conts waton
Cmnototord meta data druct&y
dhát t l the Shu aneuak hau to
manage componenta.
ode uarai t iundtond end
nauitoi
Coee amnatotio

) (a Componert - mauks a coss as a

Cofonet
Resttortrolle, ?- A Comheratton of ontetla
3-)
ond. @Risponuc Body.
Qurtomatteally by yf
s) @Qualif Rsaluee arm bugity
4 the bcme

Le cycle call Backs &.


Callbacks a abtcal methodi n
buhauae.
ianeuauk thot allout tsctom
Catlbacks allous you to peufm
a ctio at Utan
cycle staut hen thL
In shg, the the e
re cycle
Constuuttas,

Ban Initartiated

pekenotencLés Tojackeo

3)
Tnetializotion
4) Use

Deetuutt n
) Bah TituRted i ULs the Conitctat
to oeate. the bean obet.
Dapanedehtíes unjectud?- Al OAtouf xed ou
Ovalue sfuelds
3) Ttialínaton - PoatContuctt mettod us
called Coreconcepts: engineering
The bean fenfom t actual
tasks t the applitathon
S) Detuction When the aspliat on Cortest
Closes ,shsung destog(y
yethod

Bean conunaction tles


Thesee ase ban confwtin,
oltent to depu
houe CsiLatel and naagd.
) )_XmL - Based
Concgwnatios i -
You aleclae beans ulth
class a' "Com. Cxahmple. yAsan
Q.) Annototeon- Based Conigualon 3 Boans ase
ttonatieal cletacdeol useig annatotfova like
Compo nent,
i-@ecmponent
pubi't clas my&ean
modunn Sfeig
3) Taua Bad coryiqwnao .
You DConfgututilan mth
clasioc eu auanal
wwtth ton
Coreconcepts: engineering
eAing Boot: is a_a orame L(ank buelt cn
the spug btmeuank
of f'gturation.
O t ducel boilep late Con
pung Boot Categou1 to -i

2[Codle ktu dure 3. Rumesu


.| Rulld y ctems
Boat Butld systems i
Suppaste buld tals like mauok
Shsig Bot
om Gaolle
o -These. tools halp monage clifenduu'es, bud
Bsuocessea,omal packaqug.
Mauen ses ah XmL ie ca lleo pom. xml to
dyfeni Axojact confgcoatlenKotlu
.

ment spuuig oot abs.


e Both toals sphout acto -- setoodng , mlt?
macele psoyeots

G pung boot frojct Aoue a storolad stuetus


Clas haz shsungßootAppalsn
uke
qalda haldr coniuoatte
poicotonhnoheet?
qtedi contell,hadle t
dota fo es bock to u .
UseSercls
þstceMeg

Coreconcepts: engineering
stasbonue
back to

Ae compo nerti asee placad un sub - þackoqe


Al
tnde he mun class þackage fo
þaclkoge fos auto
searmina
tole tsuectue -
Com: exampli. mypp
Cortolle

Pstoqsam enaple
un potag.spsargameuosk bootShxg AAlatau
dnpast og singtsam euank. bect to tonygune
spsuig Boot-flffleato n
pukete class mgfApeAticatlon
publie
ShanAfpatin (yApppllatibn -latf,
anga)3
Boat Runnees i
qasug Boat tup uritefa css to Jueon
ul tavtup.
Colt. at appilation

ComnandLne Remnex btoatio,Rnner.

utn the sAug Boat afbliatien has stauksd.


hse ommandine Runneu fas a mettool
JLn(tung . ugs
ftþblicaton Rune has a methoc sus
Angment cgs).
These HnneS Ce Cusually uedl fase tasks
hutig dog'e.
Jke uñtialieug data , ttrg
Cautönaieally datict the uhns ahdl
oectes t ttn the abpicotien i loodad
txample stan Command LimeReune
oponert
pubitc chass myRune unhlumt Comardlnkuney
publie Motd us ( stuig . csg
Coreconcepts: engineering
3
tample fau Appication Kunnen
@Componet
puae clas myAppRumen impineti ftpplieatonXe
A
Pptation.

bacaue
a Coggen bacaie t li máne pouusqud ond
H Can psut msoges uith d i l u sik i
î) INFo "
ui) Df BUG : tasu detaiid ito
ERROR
fu) WARN -
t helbe you cendass tand.
uide the
what happnig
Coreconcepts: engineering
pubele class myclaia
poiuate tato inal dgg lagge
Loggexfactay getogges CmH Clay- clos);
þusele wold ko
do Soething. CJ
laggex . dabug (Thi i a dasug miskage");

Butkcbing RESTFUL Wes feve


A RESue ab ice allotus ditfant
Asten Cike mobile afft, eb apps) to talk
to backend ou the
HTTP.
eteps to Beucldl a RESTLul eb Ssucs,
ui Shung Boat

Csesate ashxig
Boct psogect H Csaato
modol Rapostasy
Trrtextac

Test the Cseaate .


Contalle Jeuea. clas
APL

Honclg Coreconcepts: engineering

Rtaset bt Cstatlng
Csteting a purig Boot payect
Csuat1 modal clan wig tntty .

tueth the atabose utiot spL.


Seuet clas
lutea seuee clew uuth seuice. .
elo cey RutGntoolle.
Coeati a Cortalli.
Rest Contuolleu -
GResttontuallex a Ahecal ennotaion tued
RE STul web Soueu w
Boat.
to hsate
Combuioton QCortbuallen ond
RestonCononly
aBocy eto hanll APT
wsad
O Tt
iRi GET, PosT, PT, ELETE
e You do,'t meecd to t ittabhliedd
aResponeBoy
apsLied 'auto mgt
en eLeey method
on the class (not on
nethod)i
a T settuy nd data dexicty cntead of doadg
On HTmL page
Coreconcepts: engineering
RestConcballex
puble class sornp.le Contalley
puhlie tuing homel)
.utun "aellome to y App !":
3
pabl'c stng Sate cJi

No databas e , complx tode , fut


sinple REST end potits
Kequet Mapptng i map a ciieb
RoauatMapug
URL.

PoZT, POT, DÉLE TE


By cafaut , t ca, hardle all HrTP mcthoda
can be used at bath th loleu
Cund mathod euel.
It has been ebdacecd i modnn
Boot Co de Cnnotattors
QGet mafhngannotations
Thee shsetct make the
Cooe e a i, lacnese and nase eaa.dab i. .
o Shig based
automatically detacta
Othe annatatton
Onthe
ond ma_s t.
and URL.

Coreconcepts: engineering
@Rext Cotuall
Ruqutmathg C lapt)
publs lass myContallerheheee
Req uet mapping Cualue =/helto",
mitthod - RsquutMetthod .GET)
publle tng sayHello () y
wetue Helo

Request
OReqyatBocy
Body i dota
the bo y. an HTTP qest ( dike JsoNJ
aectbnatically Comwets the JSON Aht bs
6 Tt
the ellert to a JauQ obact
PosT and puT
nethod whe. dta et om the client
to the
4 he neqet body milserg an hat
Jbua'd data ,
c,
tuth RESu cliènt
Poth vaiable i
uom the URL fath.
t allouss to. ind docta thsough

DELETE aqsti
O It måkas URLA mase
HAodobe.

tuhen Comhnid uith otes


amotatfors ke' ORagust Body -
ORestContsallas
publée eaass telLoCortallen
QGetMapping C" |hello /5rame )
puslle ctuirg SayttelkoC@PalNasial, d mam)

3 Coreconcepts: engineering
you ueaitt http /1 cdocal. host So0|halto/
Psafila
Pratibha uilt be þased
to th mthod.
buthut ?- tello, Ruatbla.
KequestfaMameken i
ORguutfasom yad to ttact docta
om the quy tul ng y a URL .
Tt alloU you to And Kay- ualue B s
Rthe URL onc. access then k yous mthod.
Tt
bt ucth othes HTTP mettds tso
YotL Cah t to make ßavcom eteu
ptional ax gui them dyfeautt ualuus.

pub.tie stuing guuctUses (6 RagcuestPouan


Stuig náne)

Coreconcepts: engineering

we Cah e mutefe Regusst Panom


nat fasoudld ond
Spung ile ticou

GET, POST, PUT, DELETE


feteh olato
Post Caate data
PUT Upoate data
DELETE : Delete Dota
GET3 o s
Uhed to git data som the Ales !

No data A tt
Rood -orly opsuion.

þuhle Stsing qetUse (aOathlaviab,la. et td)


setn " Gyetting
Coreconcepts: engineering
PosT >
O Uad to &lncl. data t the & e
Data
Ascoates tthe database
Ex

publlo setuing csuateus e (ORiqstBoy

PUT :>
O aed to wbalate asthq sesowce. complttly
Beg tees both cthe ID tu URL ahd
the up olated data, uh cthe body.
Rahtaces cthu ctie obydct utth
Beol uheh Luant to update ale felole.
DELE TE -
m digting uousce.
delte

pub tic sting delete Osn (Othvlable ost


tun Deleted ese
3
Bulld web aphlotoy i
ShDg Boat used
apeloatÝns quckt ufth minÑnal et1 .
Kuy feotunes
i) Handles boousex suquests usug Cortolleu.
demylatss
) Po cesses om dota
) f s and fetchs döta
Has a lea . Atr tue
epa to
) Creati Sfug Boat poajact
) Csuate HTmc pagsCoreconcepts: engineering
ni) CAte a cC¡rcts all
fu) Hourlirg fatm Subniysi on
) Connect to Dctabouse
ui) Run the abþication.
SU8SCRIBE
Caneenceprts icngneeng

You might also like