When a user attempts to create caching proxies using the o.s.cache.interceptor.CacheProxyFactoryBean, this fails to work.
A user might want to use the CacheProxyFactoryBean to introduce caching behavior and logic to classes from a 3rd party library. This recently came up in a StackOverflow post. Please read the post and the answers (especially this one) for further details.
Ideally, a user would be able to add caching behavior to any class, programmatically (not declaratively) using...
Also, as I pointed out in my post on StackOverflow, another way to create programmatic caching proxies, is to declare Spring'sProxyFactory and CacheInterceptor as @Bean definitions in the Spring@Configuration class, like so...
Still, using the o.s.cache.interceptor.CacheProxyFactoryBean is far more convenient and consistent with Spring's policy on complex instantiation and initialization logic nicely encapsulated with a FactoryBean.
One example of alternative methods for programmatically creating caching proxies, for possibly 3rd party library/framework classes, can be found here.
CacheProxyFactoryBean is quite a stepchild here: This class essentially never worked (in particular not since #16941), and nobody seems to have noticed and complained... Since I still consider it a rather secondary configuration variant, I went with the simplest possible revision that does the job: For 4.3.14, simply delegating BeanFactoryAware and SmartInitializatingSingleton; for 5.0.3, also adding the three additional setters from CacheInterceptor for common configuration instead of individual operation settings.
For simplicity's sake, we're just doing integration testing (since that's all that really matters here) and without any custom configuration adaptation in CacheProxyFactoryBean itself, both of which significantly streamline the implementation and make it straightforward to backport. This also keeps things very aligned with TransactionProxyFactoryBean, the original inspiration behind our class here. For those reasons, I went with a custom variant instead of your PR, John. Thanks for pointing this out and for the tests, in any case!