0 évaluation0% ont trouvé ce document utile (0 vote)
28 vues15 pages
Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure.
The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect.
Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure.
The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect.
Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure.
The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect.
$#ereas in AOP t#e 'nit o% mod'larit" is t#easpect. 1 Spring AOP
Aspects enale t#e mod'lari)ation o% concerns
s'c# as transaction management t#at c't across m'ltiple t"pes and o!ects.
S'c# concerns are o%ten termedas
crossc'ttingconcerns in AOP literat're. 1 Spring AOP
One o% t#e &e" components o% Spring is t#eAOP
%rame$or&. *#ile t#e Spring Io+ container does not depend on AOP( means $e don,t need to 'se AOP as mandator".
AOP complements Spring IO+ to provide a ver"
capale middle$are sol'tion. 1 Spring AOP AOP is 'sed in t#e Spring -rame$or& to..
provide declarative enterprise services( especiall" as a
replacement %or /01 declarative services. T#e most important s'c# service isdeclarative transaction management.
allo$ 'sers to implement c'stom aspects( complementing
t#eir 'se o% OOP $it# AOP. 1 Spring AOP
In t#eenterpriselevel application programming $e 'sed to
add cross-c'tting %'nctionalities means adding di2erent t"pes o% services to t#e application at r'ntime a'tomaticall".
*#ile implementing'sinesslogic %or real time applications(
apart %rom'sinesslogic some ot#er services also $ill e added to ma&e t#at as enterprise level one. 1 Spring AOP
According to spring( t#e services t#at areoverlappingon t#e
'siness logic are called as cross-c'tting %'nctionalities( implementing 'sinesslogic 3 services toget#er red'ce t#e code optimi)ation and increase di4c'lt" .
In order to overcome t#e s'c# prolems( $e need to separate
t#e 'siness logic and t#e services. 1 Spring AOP
T#is is &no$n as process o% separation as AOP( 5sing AOP
t#e'sinesslogic and cross-c'tting %'nctionalities are implemented separatel" and exec'ted at r'n time as comine. 1 Spring AOP AOP +oncepts and terminolog"
Aspect6 a mod'lari)ation o% a concern t#at c'ts across
m'ltiple classes. Transaction management is a good example o% a crossc'tting concern in enterprise 0ava applications. Aspects are implemented 'sing reg'lar classes (sc#ema-ased approac#) or reg'lar classes annotated $it# t#e7Aspectannotation (t#e7Aspect0st"le). 1 Spring AOP
0oin point6 a point d'ring t#e exec'tion o% a program( s'c#
as t#e exec'tion o% a met#od or t#e #andling o% an exception. In Spring AOP( a !oin pointal$a"s represents a met#od exec'tion.
Advice6 action ta&en " an aspect at a partic'lar !oin point.
8i2erent t"pes o% advice incl'de 9aro'nd(9 9e%ore9 and 9a%ter9 advice. 1 Spring AOP
(Advice t"pes are disc'ssed elo$.) :an" AOP
%rame$or&s( incl'ding Spring( model an advice as aninterceptor( maintaining a c#ain o% interceptorsaro'ndt#e !oin point.
Pointc't6 a predicate t#at matc#es !oin points. Advice is
associated $it# a pointc't expression and r'ns at an" !oin point matc#ed " t#e pointc't (%or example( t#e exec'tion o% a met#od $it# a certain name). 1 Spring AOP
T#e concept o% !oin points as matc#ed " pointc't
expressions is central to AOP( and Spring 'ses t#e Aspect0 pointc't expression lang'age " de%a'lt.
Introd'ction6 declaring additional met#ods or ;elds on
e#al% o% a t"pe. Spring AOP allo$s "o' to introd'ce ne$ inter%aces (and a corresponding implementation) to an" advised o!ect. 1 Spring AOP
Target o!ect6 o!ect eing advised " one or more
aspects. Also re%erred to as t#eadvisedo!ect. Since Spring AOP is implemented 'sing r'ntime proxies( t#is o!ect $ill al$a"s e aproxiedo!ect.
AOP prox"6 an o!ect created " t#e AOP %rame$or& in
order to implement t#e aspect contracts (advise met#od exec'tions and so on). In t#e Spring -rame$or&( an AOP prox" $ill e a 08< d"namic prox" or a +GLI1 prox". 1 +ontact 's Thanks facebook.com/apex.tgi twitter.com/ApextgiNoida pinterest.com/apextgi Stay Connected with us for more chapters on JAVA