We need to cache some data retrieved outside from what DataServices already does.
However, I can’t get a secondary CacheManager to not interfere with the cache setup from dataservices.
When I configure a secondary one like this:
@Bean(name = "myAppCacheManager")
@Order(Ordered.LOWEST_PRECEDENCE)
public CacheManager myAppCacheManager() {
CaffeineCacheManager manager = new CaffeineCacheManager("myCacheName");
manager.setCaffeine(...)
return manager;
}
However, when I start DataServices, it fails with a lot of errors like this one:
2026-03-05 15:18:37,378 [ restartedMain] [WARN ] c.m.a.d.m.b.BulkImportProblemReporter : Error while importing models
java.lang.IllegalArgumentException: Cannot find cache named 'com.mgmtp.a12.dataservices.model.GenericModel' for Builder[public com.mgmtp.a12.dataservices.model.GenericModel com.mgmtp.a12.dataservices.model.persistence.GenericModelReadRepository.readModel(java.lang.String)] caches=[com.mgmtp.a12.dataservices.model.GenericModel] | key='' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='false'
It seems that DS tries to use the alternate cache manager despite the fact that it is not the “default” cache manager.
Any ideas?