Class OpeniamCacheConfiguration

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.annotation.ImportAware

    @Configuration
    public class OpeniamCacheConfiguration
    extends org.springframework.cache.annotation.ProxyCachingConfiguration
    Author:
    Lev Bornovalov

    Overrides Spring's defualt cache configuration, allowing us to provide a custom cache interceptor.

    Required for IDMAPPS-3644

    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.springframework.cache.annotation.AbstractCachingConfiguration

        org.springframework.cache.annotation.AbstractCachingConfiguration.CachingConfigurerSupplier
    • Field Summary

      • Fields inherited from class org.springframework.cache.annotation.AbstractCachingConfiguration

        cacheManager, cacheResolver, enableCaching, errorHandler, keyGenerator
    • Constructor Detail

      • OpeniamCacheConfiguration

        public OpeniamCacheConfiguration()
    • Method Detail

      • setImportMetadata

        public void setImportMetadata​(org.springframework.core.type.AnnotationMetadata importMetadata)
        Specified by:
        setImportMetadata in interface org.springframework.context.annotation.ImportAware
        Overrides:
        setImportMetadata in class org.springframework.cache.annotation.AbstractCachingConfiguration
      • cacheAdvisor

        @Bean(name="org.springframework.cache.config.internalCacheAdvisor")
        @Role(2)
        public org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor cacheAdvisor​(org.springframework.cache.interceptor.CacheOperationSource cacheOperationSource,
                                                                                                         org.springframework.cache.interceptor.CacheInterceptor cacheInterceptor)
        Overrides:
        cacheAdvisor in class org.springframework.cache.annotation.ProxyCachingConfiguration
      • cacheOperationSource

        @Bean
        @Role(2)
        public org.springframework.cache.interceptor.CacheOperationSource cacheOperationSource()
        Overrides:
        cacheOperationSource in class org.springframework.cache.annotation.ProxyCachingConfiguration
      • cacheInterceptor

        @Bean
        @Role(2)
        public org.springframework.cache.interceptor.CacheInterceptor cacheInterceptor​(org.springframework.cache.interceptor.CacheOperationSource cacheOperationSource)
        This is a direct copy/paste from the superclass.

        However, it allows us to instantiate a custom implementation of CacheInterceptor, which we need in order to do get access to the generated @Cacheable and @Cachevict keys

        Overrides:
        cacheInterceptor in class org.springframework.cache.annotation.ProxyCachingConfiguration
      • cacheManager

        @Bean
        public org.springframework.cache.CacheManager cacheManager()
                                                            throws IOException
        Throws:
        IOException
      • keyGenerator

        @Bean
        public org.springframework.cache.interceptor.KeyGenerator keyGenerator()