In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
SpringBoot how to use aspect-oriented programming AOP and execution expression introduction, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
What we use most is the execution representation. Let's start with the execution expression.
Execution (modifiers-pattern? Ret-type-pattern declaring-type-pattern?name-pattern (param-pattern) throws-pattern?)
What execution matches is the Joinpoint. See the expression execution above is fixed, the modifier of the method is optional, the return type is required, the defined full type is optional, the name is required, the parameters are required, all of these can use wildcards.
Any public method
Execution (public * *)
The way to start with set
Execution (* set* (..))
Methods defined in the cn.freemethod.business.pack.Say interface
Execution (* cn.freemethod.business.pack.Say.* (..))
Methods in any cn.freemethod.business package
Execution (* cn.freemethod.business.*.* (..))
Any method defined in the com.xyz.service package or its subpackages
Execution (* cn.freemethod.business..*.* (..))
Any method in the com.xyz.service package
Within (com.xyz.service.*)
Any method defined in the com.xyz.service package or its subpackages
Within (com.xyz.service..*)
Any method that implements the com.xyz.service.AccountService interface
This (com.xyz.service.AccountService)
Any target object implements the method of com.xyz.service.AccountService
Target (com.xyz.service.AccountService)
In general, the proxy class (Proxy) and the target class (Target) implement the same interface, so the above two are basically equivalent.
A method with one and only one Serializable parameter
Args (java.io.Serializable)
As long as this parameter implements the java.io.Serializable interface, whether it is java.io.Serializable, Integer, or String.
The target (target) uses the @ Transactional annotation method
@ target (org.springframework.transaction.annotation.Transactional)
Target class (target) if there are all the methods in the Transactional annotation
@ within (org.springframework.transaction.annotation.Transactional)
Any method that has Transactional annotations
@ annotation (org.springframework.transaction.annotation.Transactional)
There is one and only one parameter and there are Transactional comments on the type of the parameter
@ args (org.springframework.transaction.annotation.Transactional)
Note that there are Transactional comments on the parameter types, not comments on the parameters of the method.
The name of bean is the method in tradeService
Bean (simpleSay)
The bean name is all methods in simpleSay.
Bean names can match.
Bean (* Impl)
The bean name matches all the methods in the bean of * Impl.
After reading the above, have you mastered how SpringBoot uses the introduction to aspect-oriented programming AOP and execution expressions? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.