Springframework learning part 3 About AOP Pointcut.
As mentioned in the previous summary, I will summarize Pointcut once again.
A Pointcut is a group of Join Points.
For example, the following execution is also a Join Point Pointcut.
execution(* com.nanafushi.sample.*Controller.*(..))
Pointcut allows you to specify a pattern for matching.
execution(* com.nanafushi.sample.*Controller.*(..))
Taking the above as an example, if we extract and explain in order from the left,
parts | role |
---|---|
execution | Directive. Trigger method execution |
* | Return value. Only those in void |
com.nanafushi.sample | package |
*Controller | name of the class. Class with Controller at the end |
* | Method name |
(..) | Method argument. Arbitrary argument in this case |
The wildcards that can be used with Pointcut are as follows.
Wildcard | role |
---|---|
* | The principle is an arbitrary character string Any one level for packages Any one argument for the method |
.. | For packages, any zero or greater package Any zero or more arguments for method arguments |
+ | By specifying after the class name, all subclasses and implementation classes including that class are included. |
There are various types of Pointcut. I will list the ones that I think I will use often.
Pointcut | Trigger |
---|---|
execution | For methods that match the pattern |
within | For methods of classes that match the pattern |
bean | Targets bean methods that match the pattern |
that's all. good job.
[Thorough introduction to Spring Java application development with Spring Framework](https://www.amazon.co.jp/Spring%E5%BE%B9%E5%BA%95%E5%85%A5%E9%96%80- Spring-Framework% E3% 81% AB% E3% 82% 88% E3% 82% 8BJava% E3% 82% A2% E3% 83% 97% E3% 83% AA% E3% 82% B1% E3% 83% BC% E3% 82% B7% E3% 83% A7% E3% 83% B3% E9% 96% 8B% E7% 99% BA-% E6% A0% AA% E5% BC% 8F% E4% BC% 9A % E7% A4% BENTT% E3% 83% 87% E3% 83% BC% E3% 82% BF / dp / 4798142476 /)
Recommended Posts