启动类注解
:// @EnableAspectJAutoProxy(exposeProxy = true)//基于 AopContext 暴露代理对象
获取代理对象:
// @Autowired
// public static JestClient jestClientProxy=(JestClient) AopContext.currentProxy();// new JestHttpClient();
通过 request获取:
// ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest httpServletRequest = requestAttributes.getRequest();
// WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(httpServletRequest.getSession().getServletContext());
// public static JestClient jestClientProxy = applicationContext.getBean(“jestClient”);