Using Spring AOP on App Engine causes StackOverflowError

爱⌒轻易说出口 提交于 2019-12-01 03:42:25

It seems that the issue has been fixed in App Engine version 1.9.7. See more details here.

A stack overflow usually indicates an infinite loop. With aspectj you could have this in the following case:

Class Logger {
 @Autowired
 ConfigService conf;
 //... used for logging intercepted methods
}

Class ConfigServiceImpl implements ConfigService {
 //... this is used to retrieve config
}

If you now use aspectj expressions that says: I want to log my configServiceImpl then you will also have infinite loop when using the configService:

  • intercepted by logger
  • configservice injected in logger tries to retrieve logging config ...
  • ==> that configservice is intercepted by logger and story repeats

I cannot explain why it is working on your local setup and not on app engine. Or why it is only when you are using @Configuration but I think you should look in the direction of a "circular dependency" like this.

Zeki

This is either because of infinite recursion, or because your stack is just too big. Try bumping up your stack size to see if that solves the problem (using, for example, -Xss1m). If this does not help, then you may have infinite recursion. See also:

Java stack overflow error - how to increase the stack size in Eclipse?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!