parent
a05cf1463f
commit
0478b7f7cd
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
https://www.springframework.org/schema/aop/spring-aop.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!-- 开启注解扫描 -->
|
||||
<context:component-scan base-package="com.ssm.aop"/>
|
||||
|
||||
<!-- 开启AOP自动代理 -->
|
||||
<aop:aspectj-autoproxy/>
|
||||
|
||||
<!-- 注册Bean -->
|
||||
<bean id="cls" class="com.ssm.aop.Class"/>
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ssm.aop;
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class Log {
|
||||
@Before("execution(* com.ssm.aop.*.show())")
|
||||
public void beforeAdvice(){
|
||||
System.out.println("【前置通知】方法即将执行");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue