[JAVA] About Spring AOP Pointcut

Springframework learning part 3 About AOP Pointcut.

About Pointcut

What is 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.

Pointcut configuration

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

Wildcard

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.

Type of directive

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.

Reference book

[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

About Spring AOP Pointcut
About Spring AOP
About spring AOP
About Spring ③
About binding of Spring AOP Annotation
How to write Spring AOP pointcut specifier
About Spring Security authentication
About DI of Spring ①
About DI of Spring ②
Overview of Spring AOP
[Personal memo] About Spring framework
About Spring Framework context error
Introduction to Spring Boot ② ~ AOP ~
[Java] Spring AOP execution order
About Spring DI related annotations
How to unit test Spring AOP
spring framework Simple study memo (2): AOP
About =
Spring AOP for the first time
About error when implementing spring validation
Output system log by Spring AOP technology
About Spring Dependency Injection using Java, Kotlin
About the initial display of Spring Framework