https://docs.spring.io/spring...html
AOP是面向切面編程,是OOP(面向對象)編程的補充。OOP的模塊關鍵單元在在類,而AOP在於切面。spring
通知的類型Types of advice:編程
<aop:aspectj-autoproxy/>
package org.xyz; import org.aspectj.lang.annotation.Aspect; @Aspect public class NotVeryUsefulAspect { }
通知和切點表達式關聯,在切點表達式以前,以後,執行app
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @Aspect public class BeforeExample { @Before("com.xyz.myapp.SystemArchitecture.dataAccessOperation()") public void doAccessCheck() { // ... } }