[英]IllegalAccessError on @Around - Aspectj
When calling this AspectJ @Around
function: 调用此AspectJ
@Around
函数时:
@Around("controllers() && methodsPointcut()")
public Object returnControlerLog(ProceedingJoinPoint joinPoint) throws Throwable {
Object value = joinPoint.proceed();
this.log(LogTypes.CONTROLLER, value, joinPoint.getTarget().getClass(), "CONTROLLER RETURN",
joinPoint.getSignature().getName());
return value;
}
I got 我有
java.lang.IllegalAccessError: tried to access class my.aspect.package.LogAspect$LogTypes from class my.controller.package.MyController
While inside this Spring function controller's pointed by the pointcut: 在切入点指向的此Spring函数控制器的内部:
@RequestMapping(method = RequestMethod.PUT, value = "/doSth")
public @ResponseBody JSONObject doSth(@RequestParam String sth) {
return new JSONObject().put("key", sth);
}
I just adapted this example to my needs. 我只是根据我的需要调整了这个例子 。
I have other pointcut as @Before
or @AfterThrowing
that works well. 我还有其他切入点,如
@Before
或@AfterThrowing
效果很好。
You are not showing the most important part of your code. 您没有显示代码中最重要的部分。 I see not package names, no class declaration, no aspect declaration, just snippets.
我看不到包名,没有类声明,没有方面声明,只是片段。 Next time please provide an MCVE so as to keep people from doing what I am about to do now: guessing instead of reproducing and providing solid answers.
下次,请提供MCVE ,以使人们不再做我现在要做的事情:猜测而不是复制并提供可靠的答案。
So my educated guess is that you have not declared your aspect public. 因此,我有根据的猜测是您尚未宣布您的方面公开。 Please do and be happy.
请尽力而为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.