Pointcut hauv AspectJ yog dab tsi?
Pointcut hauv AspectJ yog dab tsi?

Video: Pointcut hauv AspectJ yog dab tsi?

Video: Pointcut hauv AspectJ yog dab tsi?
Video: Spring Boot AOP Implementation with examples | Interview Questions and Answers | Code Decode 2024, Kaum ib hlis
Anonim

Lub ntsiab txhais ntawm a pointcut los ntawm AspectJ homepage: A pointcut yog ib qho kev pab cuam uas xaiv tawm cov ntsiab lus koom thiab nthuav tawm cov ntaub ntawv los ntawm kev ua tiav cov ntsiab lus ntawm cov ntsiab lus koom. Cov ntsiab lus feem ntau yog siv los ntawm cov lus qhia. Lawv tuaj yeem tsim nrog cov neeg ua haujlwm boolean los tsim lwm yam taw tes.

Hais txog qhov no, PointCut qhia yog dab tsi?

Joinpoint thiab Pointcut Expressions . Cov pointcut lus yog ib qho cuab yeej uas tso cai rau kev sib koom ua ke. A pointcut qhia txiav txim siab nyob rau hauv uas koom nrog kev ua tiav ntawm lub hauv paus system cov lus qhia yuav tsum tau hu.

Tsis tas li ntawd, qhov sib txawv ntawm Joinpoint thiab PointCut yog dab tsi? JoinPoint : Koom tes yog cov ntsiab lus hauv koj qhov kev ua tiav qhov kev khiav ntawm kev ua tiav tau hloov pauv xws li Kev Zam Txim, Hu rau lwm txoj kev. PointCut : PointCut yeej yog cov Koom tes qhov twg koj tuaj yeem muab koj cov lus qhia (lossis hu rau nam). Tag nrho cov lus piav qhia yog hu ua pointcut @Ua ntej( execution(* app.

Ua kom pom qhov no, PointCut hauv Spring AOP yog dab tsi?

PointCut . PointCut yog ib txheej ntawm ib lossis ntau qhov JoinPoint qhov twg cov lus qhia yuav tsum tau ua. Koj tuaj yeem hais qhia PointCuts siv cov lus qhia lossis cov qauv raws li peb yuav pom hauv peb AOP piv txwv. Hauv Caij nplooj ntoos hlav , PointCut pab siv JoinPoints tshwj xeeb los siv cov lus qhia.

Dab tsi yog hom lus qhia?

Tswv yim yog ib qho kev nqis tes ua los ntawm ib qho ntawm ib qho kev koom tes tshwj xeeb. Ntau hom lus qhia suav nrog "ib puag ncig," "ua ntej" thiab "tom qab" lus qhia . Lub hom phiaj tseem ceeb ntawm kev sib tw yog los txhawb cov kev txhawj xeeb hla hla, xws li kev txiav, profileing, caching, thiab kev tswj kev lag luam.

Pom zoo: