Files
springboot-demo/target/classes/com/example/demo/controller/AopEventController.class

39 lines
9.0 KiB
Plaintext
Raw Normal View History

<EFBFBD><EFBFBD><EFBFBD><EFBFBD>={
2026-03-18 15:18:30 +08:00
 java/lang/Object<init>()V  
.com/example/demo/controller/AopEventController userService&Lcom/example/demo/service/UserService;  eventPublisher+Lcom/example/demo/event/UserEventPublisher;  userEventListener*Lcom/example/demo/event/UserEventListener;  performanceAspect(Lcom/example/demo/aop/PerformanceAspect;  rateLimitAspect&Lcom/example/demo/aop/RateLimitAspect;java/util/HashMap
!message#FExplore cross-cutting behavior through AOP, events, and rate limiting. %&' () java/util/Mapput8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+topics-java/lang/String/"AOP advice and performance tracing1*Application events and listener decoupling3Annotation-driven rate limiting5 endpoints7 GET /aop/aop9GET /aop/aop/stats;GET /aop/event=POST /aop/event/publish?GET /aop/event/historyAGET /aop/ratelimitC userCount
EFG HI$com/example/demo/service/UserServicefindAll()Ljava/util/List; KLM NOjava/util/Listsize()I
QRS TUjava/lang/IntegervalueOf(I)Ljava/lang/Integer;WtitleYAOP learning notes[concepts]'Aspect: a reusable cross-cutting module_8Join point: a place where the program can be intercepteda.Pointcut: the matcher that selects join pointsc>Advice: code that runs before, after, or around the join pointe4Weaving: combining the aspect with the target objectg adviceTypesi@Before for pre-checksk@After for cleanupm&@AfterReturning for successful resultso@AfterThrowing for failuresq/@Around for timing, wrapping, and total controlsuseCasesuLoggingwPerformance measurementyAuthorization checks{ Rate limiting}Reusable validationCollected performance metrics<00> description<00>FThese numbers come from the around advice on controllers and services.<00>
2026-03-18 15:18:30 +08:00
statistics
<00><00><00> <00><00>&com/example/demo/aop/PerformanceAspect getStatistics()Ljava/util/Map;<00>Spring application events<00><ApplicationEventPublisher emits a domain or lifecycle event.<00>;@EventListener reacts without tight coupling to the caller.<00>@@Async lets slow follow-up work happen outside the request path.<00>5Conditions help one listener focus on one event type.<00>benefits<00>Controllers stay smaller.<00>!Listeners can grow independently.<00>"The request flow stays responsive.<00>#Side effects become easier to test.<00>
eventTypes
<00><00><00> <00><00>%com/example/demo/model/UserEvent$Typevalues*()[Lcom/example/demo/model/UserEvent$Type;
<00> <00><00> resolveType;(Ljava/lang/String;)Lcom/example/demo/model/UserEvent$Type; <00><00><00> <00><00>0com/example/demo/controller/AopEventController$10$SwitchMap$com$example$demo$model$UserEvent$Type[I
<00><00> <00>Oordinal<00>&java/lang/IncompatibleClassChangeError
<00><00>&User was created through the demo flow<00>.User profile was updated through the demo flow<00>&User was removed through the demo flow<00>$User signed in through the demo flow
<00><00><00> <00><00>)com/example/demo/event/UserEventPublisherpublishUserEvent^(Ljava/lang/Long;Ljava/lang/String;Lcom/example/demo/model/UserEvent$Type;Ljava/lang/String;)V<00>Event published successfully.<00> eventType
<00><00> <00><00>name()Ljava/lang/String;<00>userId<00>userName<00> historySize
<00><00><00> <00>I(com/example/demo/event/UserEventListenergetEventHistory K<00> <00><00>stream()Ljava/util/stream/Stream;<00> <00><00>apply()Ljava/util/function/Function; <00><00><00> <00><00>java/util/stream/Streammap8(Ljava/util/function/Function;)Ljava/util/stream/Stream; <00><00> <00>ItoList<00>Recent user event history<00>total<00>items<00>,Rate-limited endpoint executed successfully.<00>note<00>@The @RateLimited annotation wraps this method through an aspect.<00>rateLimitStatus
<00><00><00> <00><00>$com/example/demo/aop/RateLimitAspectgetRateLimitStatus
,<00> <00><00>trim
, <00> toUpperCase
<00> T<00>java/lang/Exception <00>  
LOGIN'Lcom/example/demo/model/UserEvent$Type; type
  com/example/demo/model/UserEventgetType)()Lcom/example/demo/model/UserEvent$Type;
  getUserId()Ljava/lang/Long;
 <00> getUserNamedetail
 <00> getDetail  timestamp
" #$ getTimestamp()Ljava/time/LocalDateTime;
&'( )<00>java/time/LocalDateTimetoString %+ ,-of<00>(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;<00>(Lcom/example/demo/service/UserService;Lcom/example/demo/event/UserEventPublisher;Lcom/example/demo/event/UserEventListener;Lcom/example/demo/aop/PerformanceAspect;Lcom/example/demo/aop/RateLimitAspect;)VCodeLineNumberTableLocalVariableTablethis0Lcom/example/demo/controller/AopEventController;MethodParametersindexinfoLjava/util/Map;LocalVariableTypeTable5Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>; Signature7()Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;RuntimeVisibleAnnotations4Lorg/springframework/web/bind/annotation/GetMapping;aopInfovalue/aopgetPerformanceStatsresult
/aop/stats eventInfo/event publishEventE(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Map;Ljava/lang/Long;Ljava/lang/String; StackMapTablek(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;5Lorg/springframework/web/bind/annotation/PostMapping;/event/publish"RuntimeVisibleParameterAnnotations6Lorg/springframework/web/bind/annotation/RequestParam; defaultValueLjava/util/List;GLjava/util/List<Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;>;/event/history testRateLimit
/ratelimit"Lcom/example/demo/aop/RateLimited;
<Demo limit reached: only 10 requests per minute are allowed.ignoredLjava/lang/Exception;rawTypelambda$getEventHistory$03(Lcom/example/demo/model/UserEvent;)Ljava/util/Map;event"Lcom/example/demo/model/UserEvent;
SourceFileAopEventController.java8Lorg/springframework/web/bind/annotation/RestController;8Lorg/springframework/web/bind/annotation/RequestMapping; NestMembersBootstrapMethodsh
ijk lm"java/lang/invoke/LambdaMetafactory metafactory<00>(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;o&(Ljava/lang/Object;)Ljava/lang/Object;q
r ]^^ InnerClassesTypew%java/lang/invoke/MethodHandles$Lookupyjava/lang/invoke/MethodHandlesLookup! 
./<00> *<2A>*+<2B>*,<2C> *-<2D>*<04>*<05><19>0"# $%&'(1> 23     4 5<00>/<00>u<>Y<>L+ "<22>$W+*<06>,Y.SY0SY2S<32>$W+4<06>,Y6SY8SY:SY<SY>SY@S<>$W+B*<2A><07>D<>J<00>P<>$W+<2B>0,-./3[;s<1u23m678 m69:;<=><00>/<00><00><>Y<>L+VX<>$W+Z<08>,Y\SY^SY`SYbSYdS<64>$W+f<08>,YhSYjSYlSYnSYpS<70>$W+r<08>,YtSYvSYxSYzSY|S<>$W+<2B>0ABC9J_Q<00>X1<00>23678 69:;<=?[s@A<00>/<00>0<>Y<>L+V~<7E>$W+<12><12><>$W+<12>*<2A><15><00><>$W+<2B>0]^_`.a1023(B78 (B9:;<=?[sCD<00>/<00>c<>Y<>L+V<12><>$W+Z<07>,Y<12>SY<12>SY<12>SY<12>S<EFBFBD>$W+<12><07>,Y<12>SY<12>SY<12>SY<12>S<EFBFBD>$W+<12><><00><>$W+<2B>0fgh4nUtau1c23[678 [69:;<=?[sEFG/p<00>*-<2D><00>:<04><00><04><00>.<2E> (-27<><00>Y<EFBFBD><00><><12><><12><>
<12><><12>:*<2A> +,<05><00><>Y<>: ƹ$W<12><04>ʹ$W<12>+<2B>$W<12>,<2C>$W<12>*<2A><11>ԹJ<00>P<>$W<06>0:~8<00>=<00>B<00>G<00>K<00>X<00>a<00>m<00>|<00><00><00><00><00><00><00>1H<00>23<00><00>H<00><00>I<00><00>I<00> 
KcIaMB78 aMB9J<06>0<00>A,4 <00><00><00>:K<L?[sMNOOOPs <00><00>/<00>M*<2A><11>Թ<00><00><00><00><00><00><00>L<>Y<>M,V<12><>$W,<12>+<2B>J<00>P<>$W,<12>+<2B>$W,<2C>0"<00><00><00><00>$<00>/<00>A<00>K<00>1 M231<00>Q$)B781<00>R$)B9:;<=?[sST<00>/<00>0<>Y<>L+ <12><>$W+<12><12><>$W+<12>*<2A><19><00><>$W+<2B>0<00><00><00><00>.<00>1023(B78 (B9:;<=?[sUV?JW!sY<00><00>/j+<2B><00><><00><03>M<EFBFBD><07>
0<00> <00> <00>1  Z[23\IJK4\
]^/m
+ *<2A> <0A><00><12>*<2A><12>*<2A>*<2A>*<2A>!<21>%<25>*<2A>0<00><00> <00><00><00>!<00>'<00>1 +_`ab<cd?[s@e<00>f gnpst<00>u@<00>vxz