美文网首页全面攻略SpringBoot
SpringBoot整合Redis作为缓存(二)

SpringBoot整合Redis作为缓存(二)

作者: Invi | 来源:发表于2019-05-05 17:05 被阅读0次

    sping能使用redis存储数据后,下一步Spring整合Redis作为缓存。

    Spring整合Redis作为缓存

    原理:

    1.在此之前当我们在pom.xml dependencies 中引入redis starter依赖以后

    <dependencies>
        <!--Redis 缓存-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
     
    </dependencies>
    
    

    2.打开Spring配置报告 debug=true

    3.在日志中已经看到: RedisCacheConfiguration 已经注入

    RedisCacheConfiguration matched:
          - Cache org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration automatic cache type (CacheCondition)
    

    RedisCacheConfiguration已经匹配。

    SimpleCacheConfiguration:
          Did not match:
             - @ConditionalOnMissingBean (types: org.springframework.cache.CacheManager; SearchStrategy: all) found bean 'cacheManager' (OnBeanCondition)
    

    SimpleCacheConfiguration没有匹配。

    说明:

    4.RedisCacheConfiguration替换ConcurrentMapCacheManager

    默认注入SimpleCacheConfiguration

    ConcurrentMapCacheManager 创建缓存组件:ConcurrentMapCache

    ConcurrentMapCache 使用 ConcurrentMap<Object, Object> store 存储缓存。

    1.RedisCacheConfiguration

    RedisCacheConfiguration 为容器注入了新的缓存管理器 RedisCacheManager ,其他的CacheManager将不在起作用。

    容器中由 ConcurrentMapCacheManager 变为 RedisCacheManager

    源码:

    package org.springframework.boot.autoconfigure.cache;
    
    ......
        
    @Configuration
    @AutoConfigureAfter(RedisAutoConfiguration.class)
    @ConditionalOnBean(RedisTemplate.class)
    @ConditionalOnMissingBean(CacheManager.class)
    @Conditional(CacheCondition.class)
    class RedisCacheConfiguration {
    
       private final CacheProperties cacheProperties;
    
       private final CacheManagerCustomizers customizerInvoker;
    
       RedisCacheConfiguration(CacheProperties cacheProperties,
             CacheManagerCustomizers customizerInvoker) {
          this.cacheProperties = cacheProperties;
          this.customizerInvoker = customizerInvoker;
       }
    
       @Bean
       public RedisCacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
          RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
          cacheManager.setUsePrefix(true);
          List<String> cacheNames = this.cacheProperties.getCacheNames();
          if (!cacheNames.isEmpty()) {
             cacheManager.setCacheNames(cacheNames);
          }
          return this.customizerInvoker.customize(cacheManager);
       }
    
    }
    
    • 由此得知 RedisCacheManager在操作数据时使用的是RedisTemplate<Object, Object> redisTemplate

      进而,我们在创建CacheManager时可以考虑使用RedisCacheManager操作我们指定RedisTemplate,进而方式乱码。


    至此我们已经知道,redis缓存已经默认的起效了。测试下是否生效:

    缓存配置:

      @Cacheable(cacheNames = {"Emp", "temp"}, key = "#id")
        public Employee getEmployee(Integer id) {
            System.out.println("①查询一个员工:" + id);
            return employeeMapper.getEmpById(id);
        }
    

    调用查询方法: localhost:8080/emp/4

    返回:

    {
      "id": 4,
      "lastName": "lisi",
      "gender": null,
      "email": "123@123.com",
      "dId": null
    }
    

    redis中存储了存在:


    2019-03-01 10.45.44.png

    redis中对象存在乱码,上一章节中存储数据也出现乱码。

    需要我们处理乱码:

    2.RedisTemplate

    RedisCacheConfiguration源码中看出:

        @Bean
        public RedisCacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
            RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
            cacheManager.setUsePrefix(true);
            List<String> cacheNames = this.cacheProperties.getCacheNames();
            if (!cacheNames.isEmpty()) {
                cacheManager.setCacheNames(cacheNames);
            }
            return this.customizerInvoker.customize(cacheManager);
        }
    

    RedisCacheManager 默认是操作 RedisTemplate<Object, Object> redisTemplate 操作数据的。

    RedisTemplate<K, V> redisTemplate 默认使用的 JdkSerializationRedisSerializer 序列化数据,导致乱码的。

    RedisTemplate默认使用JDK源码:

    package org.springframework.data.redis.core;
    ....
    
    public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperations<K, V>, BeanClassLoaderAware {
        
    ....
    
      if (defaultSerializer == null) {
    
         defaultSerializer = new JdkSerializationRedisSerializer(
               classLoader != null ? classLoader : this.getClass().getClassLoader());
      }
       
    ....
    
    }
    

    问题

    我们需要:

    1. 为存储对象创建自定义redisTemplate: RedisTemplate<Object, 自定义对象> redisTemplate

      上一章用spring操作redis已经配置过。不再需要配置新的。

    2. 为存储对象创建自定义的RedisCacheManager:并且将自定义的redisTemplate传入。

    3. 为存储对象指定自定义的RedisCacheManager。

    顺带了解下RedisTemplate<Object, Object> redisTemplate由来:

    RedisTemplate<Object, Object> redisTemplate 是由 RedisAutoConfiguration自动注入时创建的

    源码:

    package org.springframework.boot.autoconfigure.data.redis;
       
      ....
    
    @Configuration
    @ConditionalOnClass({ JedisConnection.class, RedisOperations.class, Jedis.class })
    @EnableConfigurationProperties(RedisProperties.class)
    public class RedisAutoConfiguration {
    
        ....
      
      /**
       * Standard Redis configuration.
       */
      @Configuration
      protected static class RedisConfiguration {
    
          @Bean
          @ConditionalOnMissingBean(name = "redisTemplate")
          public RedisTemplate<Object, Object> redisTemplate(
                  RedisConnectionFactory redisConnectionFactory)
                  throws UnknownHostException {
              RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>();
              template.setConnectionFactory(redisConnectionFactory);
              return template;
          }
    
          @Bean
          @ConditionalOnMissingBean(StringRedisTemplate.class)
          public StringRedisTemplate stringRedisTemplate(
                  RedisConnectionFactory redisConnectionFactory)
                  throws UnknownHostException {
              StringRedisTemplate template = new StringRedisTemplate();
              template.setConnectionFactory(redisConnectionFactory);
              return template;
          }
    
      }
    
    }
    

    3.RedisCacheManager

    RedisCacheManager为我们创建**RedisCache **作为缓存组件。源码如下

    RedisCacheManager在操作数据时使用的是RedisTemplate<Object, Object> redisTemplate

    源码:

    
    package org.springframework.data.redis.cache;
    
    public class RedisCacheManager extends AbstractTransactionSupportingCacheManager {
     
       ....
       
       @Deprecated
       protected Cache createAndAddCache(String cacheName) {
    
          Cache cache = super.getCache(cacheName);
          return cache != null ? cache : createCache(cacheName);
       }
       ......
        
    
       @SuppressWarnings("unchecked")
       protected RedisCache createCache(String cacheName) {
          long expiration = computeExpiration(cacheName);
          return new RedisCache(cacheName, (usePrefix ? cachePrefix.prefix(cacheName) : null), redisOperations, expiration,
                cacheNullValues);
       }
    
     .....
    }
    

    4.RedisCache

    RedisCache组件 通过操作redis数据存储到数据库中。

    此时容器中的bean:注入了默认的 cacheManager (<u>附件1.没有自定义CacheManager之前IO中所有的bean</u>)

    5.自定义CacheManager

    RedisCacheManager可以用RedisTemplate操作数据

    这里我们也使用 RedisCacheManager,可以用它来操作 RedisTemplate<Object, Object>

    这里的value可以指定我们操作的对象:RedisTemplate<Object, Employee>

    RedisCacheManager cacheManager = new RedisCacheManager(employeeRedisTemplate);

    添加新的配置信息:

    package com.invi.cache.config;
    
    ...
        
    @Configuration
    public class CustomRedisConfig {
    
        @Bean("maizi-employeeRedisTemplate")
        public RedisTemplate<Object, Employee> employeeRedisTemplate(
                RedisConnectionFactory redisConnectionFactory)
                throws UnknownHostException {
            RedisTemplate<Object, Employee> employeeRedisTemplate = new RedisTemplate<Object, Employee>();
            employeeRedisTemplate.setConnectionFactory(redisConnectionFactory);
            //设置默认序列化器
            Jackson2JsonRedisSerializer<Employee> employeeSerializer = new Jackson2JsonRedisSerializer<Employee>(Employee.class);
            employeeRedisTemplate.setDefaultSerializer(employeeSerializer);
            return employeeRedisTemplate;
        }
    
    
        //CacheManagerCustomizers 可以定制缓存规则
        //生效条件@ConditionalOnMissingBean(CacheManager.class)
        @Bean("maizi-employeeCacheManager")
        public RedisCacheManager employeeCacheManager(RedisTemplate<Object, Employee> employeeRedisTemplate) {
            RedisCacheManager cacheManager = new RedisCacheManager(employeeRedisTemplate);
            //启用CacheName作为Key的前缀
            cacheManager.setUsePrefix(true);
            return cacheManager;
        }
    
    }
        
    
    • @Primary注意设置默认的CacheManager
    • @Bean默认名字方法名,这里使用自定义,方便看IO中的组件名

    自定义的 maizi-employeeCacheManager如何生效的?

    在RedisCacheConfiguration有类注解

    @ConditionalOnMissingBean(CacheManager.class)

    得知,当我们新增的employeeCacheManager时,容器替换了系统的CacheManager。

    6.使用自定义RedisCacheManager

    上一步我们已经创建好自定义CacheManager,maizi-employeeCacheManager

    有两种使用方法:

    • 为一个方法中指定

      @Cacheable(cacheNames = {"Emp", "temp"}, 
                 key = "#id", 
                 cacheManager = "maizi-employeeCacheManager")
      public Employee getEmployee(Integer id) {
          System.out.println("①查询一个员工:" + id);
          return employeeMapper.getEmpById(id);
      }
      
    • 为一个类指定

      //抽取缓存的公共配置
      @CacheConfig(cacheNames = {"Emp", "temp"},
                   cacheManager = "maizi-employeeCacheManager")
      @Service
      public class EmployeeService {
         ......
      }
      

    7.非注解使用自定义RedisCacheManager

    package com.invi.cache.service;
    
    import com.invi.cache.bean.Department;
    import com.invi.cache.bean.Employee;
    import com.invi.cache.mapper.DepartmentMapper;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Qualifier;
    import org.springframework.cache.Cache;
    import org.springframework.cache.CacheManager;
    import org.springframework.cache.annotation.CacheConfig;
    import org.springframework.cache.annotation.Cacheable;
    import org.springframework.stereotype.Service;
    
    
    @Service
    public class DepartmentService {
    
    
        @Autowired
        DepartmentMapper departmentMapper;
     
    
        //方法内部,不通过注解使用缓存。
        //指定使用的缓存管理器
        @Autowired
        @Qualifier("maizi-departmentCacheManager")
        CacheManager departmentCacheManager;
    
        
        public Department getDepartmentById(Integer id) {
    
            Department department = departmentMapper.getDepartmentById(id);
            //获取缓存
            Cache dept = departmentCacheManager.getCache("dept");
            //存储缓存
            dept.put("getDeptById", department);
            return department;
        }
    
    }
    
    
    
    

    至此,完结,撒花~

    附件:

    附件1.没有注入自定义CacheManager之前IO中所有的bean

    存在cacheManager

    basicErrorController
    beanNameHandlerMapping
    beanNameViewResolver
    cacheAutoConfigurationValidator
    cacheInterceptor
    cacheManager
    cacheManagerCustomizers
    cacheOperationSource
    characterEncodingFilter
    conventionErrorViewResolver
    customCachingConfig
    customKeyGenerator
    customRedisConfig
    dataSource
    dataSourceInitializer
    dataSourceInitializerPostProcessor
    defaultServletHandlerMapping
    defaultValidator
    defaultViewResolver
    departmentController
    departmentMapper
    departmentService
    dispatcherServlet
    dispatcherServletRegistration
    duplicateServerPropertiesDetector
    embeddedServletContainerCustomizerBeanPostProcessor
    employeeController
    employeeMapper
    employeeService
    error
    errorAttributes
    errorPageCustomizer
    errorPageRegistrarBeanPostProcessor
    faviconHandlerMapping
    faviconRequestHandler
    handlerExceptionResolver
    hiddenHttpMethodFilter
    httpPutFormContentFilter
    httpRequestHandlerAdapter
    jacksonGeoModule
    jacksonObjectMapper
    jacksonObjectMapperBuilder
    jdbcTemplate
    jsonComponentModule
    keyValueMappingContext
    localeCharsetMappingsCustomizer
    maizi-departmentRedisTemplate
    maizi-employeeRedisTemplate
    maizi-keyGenerator
    mappingJackson2HttpMessageConverter
    messageConverters
    methodValidationPostProcessor
    multipartConfigElement
    multipartResolver
    mvcContentNegotiationManager
    mvcConversionService
    mvcHandlerMappingIntrospector
    mvcPathMatcher
    mvcResourceUrlProvider
    mvcUriComponentsContributor
    mvcUrlPathHelper
    mvcValidator
    mvcViewResolver
    mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties
    namedParameterJdbcTemplate
    org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration
    org.springframework.aop.config.internalAutoProxyCreator
    org.springframework.boot.autoconfigure.AutoConfigurationPackages
    org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
    org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration
    org.springframework.boot.autoconfigure.condition.BeanTypeRegistry
    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
    org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConnectionConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
    org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
    org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat
    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration
    org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
    org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$TomcatDataSourcePoolMetadataProviderConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration$CglibAutoProxyConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$TransactionTemplateConfiguration
    org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration
    org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
    org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration
    org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration
    org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
    org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration
    org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration
    org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration
    org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration
    org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration
    org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration
    org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration
    org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor
    org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store
    org.springframework.boot.test.mock.mockito.MockitoPostProcessor
    org.springframework.boot.test.mock.mockito.MockitoPostProcessor$SpyPostProcessor
    org.springframework.cache.annotation.ProxyCachingConfiguration
    org.springframework.cache.config.internalCacheAdvisor
    org.springframework.context.annotation.internalAutowiredAnnotationProcessor
    org.springframework.context.annotation.internalCommonAnnotationProcessor
    org.springframework.context.annotation.internalConfigurationAnnotationProcessor
    org.springframework.context.annotation.internalRequiredAnnotationProcessor
    org.springframework.context.event.internalEventListenerFactory
    org.springframework.context.event.internalEventListenerProcessor
    org.springframework.data.web.config.ProjectingArgumentResolverRegistrar
    org.springframework.data.web.config.SpringDataJacksonConfiguration
    org.springframework.data.web.config.SpringDataWebConfiguration
    org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration
    org.springframework.transaction.config.internalTransactionAdvisor
    org.springframework.transaction.config.internalTransactionalEventListenerFactory
    pageableResolver
    persistenceExceptionTranslationPostProcessor
    platformTransactionManagerCustomizers
    preserveErrorControllerTargetClassPostProcessor
    projectingArgumentResolverBeanPostProcessor
    propertySourcesPlaceholderConfigurer
    redisConnectionFactory
    redisConverter
    redisCustomConversions
    redisKeyValueAdapter
    redisKeyValueTemplate
    redisReferenceResolver
    redisTemplate
    requestContextFilter
    requestMappingHandlerAdapter
    requestMappingHandlerMapping
    resourceHandlerMapping
    restTemplateBuilder
    serverProperties
    simpleControllerHandlerAdapter
    sortResolver
    spring.cache-org.springframework.boot.autoconfigure.cache.CacheProperties
    spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
    spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties
    spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties
    spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties
    spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties
    spring.mvc-org.springframework.boot.autoconfigure.web.WebMvcProperties
    spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties
    spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties
    spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties
    springboot01CacheApplication
    sqlSessionFactory
    sqlSessionTemplate
    standardJacksonObjectMapperBuilderCustomizer
    stringHttpMessageConverter
    stringRedisTemplate
    tomcatEmbeddedServletContainerFactory
    tomcatPoolDataSourceMetadataProvider
    transactionAttributeSource
    transactionInterceptor
    transactionManager
    transactionTemplate
    viewControllerHandlerMapping
    viewResolver
    websocketContainerCustomizer
    welcomePageHandlerMapping
    

    附件2.已经注入自定义CacheManager之后IO中所有的bean

    发现默认的CacheManager将被以下取代:

    maizi-cacheManager
    maizi-departmentCacheManager
    maizi-departmentRedisTemplate
    maizi-employeeCacheManager

    basicErrorController
    beanNameHandlerMapping
    beanNameViewResolver
    cacheInterceptor
    cacheOperationSource
    characterEncodingFilter
    conventionErrorViewResolver
    customCachingConfig
    customKeyGenerator
    customRedisConfig
    dataSource
    dataSourceInitializer
    dataSourceInitializerPostProcessor
    defaultServletHandlerMapping
    defaultValidator
    defaultViewResolver
    departmentController
    departmentMapper
    departmentService
    dispatcherServlet
    dispatcherServletRegistration
    duplicateServerPropertiesDetector
    embeddedServletContainerCustomizerBeanPostProcessor
    employeeController
    employeeMapper
    employeeService
    error
    errorAttributes
    errorPageCustomizer
    errorPageRegistrarBeanPostProcessor
    faviconHandlerMapping
    faviconRequestHandler
    handlerExceptionResolver
    hiddenHttpMethodFilter
    httpPutFormContentFilter
    httpRequestHandlerAdapter
    jacksonGeoModule
    jacksonObjectMapper
    jacksonObjectMapperBuilder
    jdbcTemplate
    jsonComponentModule
    keyValueMappingContext
    localeCharsetMappingsCustomizer
    maizi-cacheManager
    maizi-departmentCacheManager
    maizi-departmentRedisTemplate
    maizi-employeeCacheManager
    maizi-employeeRedisTemplate
    maizi-keyGenerator
    mappingJackson2HttpMessageConverter
    messageConverters
    methodValidationPostProcessor
    multipartConfigElement
    multipartResolver
    mvcContentNegotiationManager
    mvcConversionService
    mvcHandlerMappingIntrospector
    mvcPathMatcher
    mvcResourceUrlProvider
    mvcUriComponentsContributor
    mvcUrlPathHelper
    mvcValidator
    mvcViewResolver
    mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties
    namedParameterJdbcTemplate
    org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration
    org.springframework.aop.config.internalAutoProxyCreator
    org.springframework.boot.autoconfigure.AutoConfigurationPackages
    org.springframework.boot.autoconfigure.condition.BeanTypeRegistry
    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
    org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConnectionConfiguration
    org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
    org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
    org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration
    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat
    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration
    org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration
    org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
    org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$TomcatDataSourcePoolMetadataProviderConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration$CglibAutoProxyConfiguration
    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$TransactionTemplateConfiguration
    org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration
    org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration
    org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
    org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration
    org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration
    org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration
    org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
    org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration
    org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration
    org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration
    org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration
    org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter
    org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration
    org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration
    org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration
    org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor
    org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store
    org.springframework.boot.test.mock.mockito.MockitoPostProcessor
    org.springframework.boot.test.mock.mockito.MockitoPostProcessor$SpyPostProcessor
    org.springframework.cache.annotation.ProxyCachingConfiguration
    org.springframework.cache.config.internalCacheAdvisor
    org.springframework.context.annotation.internalAutowiredAnnotationProcessor
    org.springframework.context.annotation.internalCommonAnnotationProcessor
    org.springframework.context.annotation.internalConfigurationAnnotationProcessor
    org.springframework.context.annotation.internalRequiredAnnotationProcessor
    org.springframework.context.event.internalEventListenerFactory
    org.springframework.context.event.internalEventListenerProcessor
    org.springframework.data.web.config.ProjectingArgumentResolverRegistrar
    org.springframework.data.web.config.SpringDataJacksonConfiguration
    org.springframework.data.web.config.SpringDataWebConfiguration
    org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration
    org.springframework.transaction.config.internalTransactionAdvisor
    org.springframework.transaction.config.internalTransactionalEventListenerFactory
    pageableResolver
    persistenceExceptionTranslationPostProcessor
    platformTransactionManagerCustomizers
    preserveErrorControllerTargetClassPostProcessor
    projectingArgumentResolverBeanPostProcessor
    propertySourcesPlaceholderConfigurer
    redisConnectionFactory
    redisConverter
    redisCustomConversions
    redisKeyValueAdapter
    redisKeyValueTemplate
    redisReferenceResolver
    redisTemplate
    requestContextFilter
    requestMappingHandlerAdapter
    requestMappingHandlerMapping
    resourceHandlerMapping
    restTemplateBuilder
    serverProperties
    simpleControllerHandlerAdapter
    sortResolver
    spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
    spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties
    spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties
    spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties
    spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties
    spring.mvc-org.springframework.boot.autoconfigure.web.WebMvcProperties
    spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties
    spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties
    spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties
    springboot01CacheApplication
    sqlSessionFactory
    sqlSessionTemplate
    standardJacksonObjectMapperBuilderCustomizer
    stringHttpMessageConverter
    stringRedisTemplate
    tomcatEmbeddedServletContainerFactory
    tomcatPoolDataSourceMetadataProvider
    transactionAttributeSource
    transactionInterceptor
    transactionManager
    transactionTemplate
    viewControllerHandlerMapping
    viewResolver
    websocketContainerCustomizer
    welcomePageHandlerMapping
    
    

    相关文章

      网友评论

        本文标题:SpringBoot整合Redis作为缓存(二)

        本文链接:https://www.haomeiwen.com/subject/hsmhoqtx.html