spring-210728-04—AOP-了解完全注解式开发
- ConfigAop.java
ConfigAop.java
package com.bgy.spring.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/*
开启注解扫描
@ComponentScan(basePackages = {"com.bgy.spring"})
↑↑ 相当于 ↓↓
<context:component-scan base-package="com.bgy.spring.aoptest"></context:component-scan>
*/
/*
开启Aspect生成代理对象
@EnableAspectJAutoProxy(proxyTargetClass = true)
↑↑ 相当于 ↓↓
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
*/
@Configuration
@ComponentScan(basePackages = {"com.bgy.spring"})
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class ConfigAop {
}