The solution to the failure of Internal call in Spring @ Cacheable Annotation Class
In this issue, the editor will bring you solutions to the failure of internal calls to the Spring @ Cacheable annotation class. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.
The internal call to the @ Cacheable annotation class is invalid
If you just want to use a lightweight caching scheme, you can try using the Spring cache scheme.
Then when using the spring @ Cacheable annotation, note that if the method f () of class An is annotated with @ Cacheable, then @ Cacheable does not work when other methods of class A, such as f2 (), call f () directly, because @ Cacheable is based on the spring aop proxy class, f2 () belongs to the internal method, and does not use the proxy when calling f () directly.
For example:
@ Cacheable (key = "# entityType", value = "xxxCache") public List