Spring获取代理类

方式一

@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)

你可能感兴趣的:(学习,spring,java,后端)