Spring获取代理类

2022-07-02 07:59:31

方式一

@Autowired
ApplicationContext applicationContext;
applicationContext.getBean(接口类.class)

方式二

(xxx) AopContext.currentProxy();

注意方式二
Cannot find current proxy: Set ‘exposeProxy’ property on Advised to ‘true’ to make it available.
添加:@EnableAspectJAutoProxy(exposeProxy = true)

  • 作者:止礼
  • 原文链接:https://blog.csdn.net/qq_34631813/article/details/122712589
    更新时间:2022-07-02 07:59:31