Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution to the failure of Internal call in Spring @ Cacheable Annotation Class

Shulou Source: shulou.com Published: 2022-06-02 04:32:03 10月03日 Update

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

Tags: Method annotation cache time proxy object content parameter name instance scheme type analysis upper and lower context professional small and medium function example rich in content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Huawei MySQL Redmi