Find a way to test a custom CacheInterceptor without using bean overriding #32530
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: superseded
An issue that has been superseded by another
type: task
A general task
In our efforts to get rid of bean overriding in the core framework, I am trying to migrate tests that use bean overriding.
JCacheCustomInterceptorTests
is one of those, it exposes aJCacheInterceptor
bean that should replace the infrastructure one that@EnableCaching
produces. Now I've done the full exercise, I came to the conclusion that the test does not longer reproduce a valid use case (i.e. if a user tries to customize the infratructure, it will face the same problem).Things I've tried:
@EnableCaching
and then import the individual components with an override for the one I want to customize: the infrastructure relies on@EnableCaching
to be present and fail hard if it's not present.AutoProxyRegistrar
that doesn't do anything (silently) as it can't find an@Enable
-like annotation that provides themode
andproxyTargetClass
attributes.BeanPostProcessor
to replace the interceptor bean. It's extra hard as the BPP needs to be configured before the caching infrastructure is registered.I've managed to make it work by calling
addBeanPostProcessor
before registering the configuration class that enables caching.It would be interesting to see how far we want to go with this. If we test this, then it must be possible for a user to have a valid configuration arrangement that does a similar thing.
The text was updated successfully, but these errors were encountered: