0
点赞
收藏
分享

微信扫一扫

AOP完全注解开发AspectJ

这里需要改的只有配置文件xml换成java文件:

package cn.zsp.spring5.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;


@Configuration
@ComponentScan(basePackages = {"com.atguigu"})
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class ConfigAop {
}

测试类:

    @Test
public void test3(){
AnnotationConfigApplicationContext configApplicationContext = new AnnotationConfigApplicationContext(configDemo.class);
User bean = configApplicationContext.getBean(User.class);
bean.add();
}

AOP完全注解开发AspectJ_spring

文件的位置为:
AOP完全注解开发AspectJ_xml_02


举报

相关推荐

0 条评论