title: spring boot cache not support kotlin?
body: <p>I'm try to replace some java code with kotlin.</p>
  
  <p>Such as jpa or cache.</p>
  
  <p>The Start class is:</p>
  
  <pre><code>@EnableAsync
  @EnableCaching
  @EnableSwagger2
  @SpringBootApplication
  open class Application
  
  fun main(args: Array&lt;String&gt;) {
      SpringApplication.run(Application::class.java)
  }
  </code></pre>
  
  <p>The simple controller:</p>
  
  <pre><code>@RestController
  class CacheController {
  
      @Autowired
      private lateinit var cache: CacheService
  
      @PutMapping("{id}")
      fun save(@PathVariable id: Long) {
          cache.save(id)
      }
  }
  </code></pre>
  
  <p>CacheService:</p>
  
  <pre><code>@Component
  @CacheConfig(cacheNames = arrayOf("longCacheManager"), cacheManager = "longCacheManager")
  open class CacheService {
  
      @Cacheable(key = "#id")
      fun save(id: Long): Long {
          return id
      }
  }
  </code></pre>
  
  <p>cacheManager:</p>
  
  <pre><code>@Configuration
  open class CacheConfig {
  
      @Autowired
      private lateinit var redisConnectionFactory: RedisConnectionFactory
  
      @Bean
      @Qualifier("longCacheManager")
      open fun longCacheManager(): CacheManager {
          val redisTemplate = StringRedisTemplate(redisConnectionFactory)
          redisTemplate.valueSerializer = GenericToStringSerializer(Long::class.java)
          val cacheManager = RedisCacheManager(redisTemplate)
          cacheManager.setUsePrefix(true)
          return cacheManager
      }
  }
  </code></pre>
  
  <p>I can confirm the parameter of id entered in CacheService's method save, but after I have excute the PutMethod, there is nothing in redis.</p>
  
  <p>When I write the cacheServie with java like this, the redis would be save what I want.</p>
  
  <p>The Java cache service like this:</p>
  
  <pre><code>@Component
  @CacheConfig(cacheNames = "longCacheManager", cacheManager = "longCacheManager")
  public class JavaCacheService {
  
      @Cacheable(key = "#id")
      public Long save(Long id) {
          return id;
      }
  }
  </code></pre>
  
  <p>I have also read some article like this:
  <a href="https://pathtogeek.com/spring-boot-caching-with-kotlin" rel="nofollow noreferrer">https://pathtogeek.com/spring-boot-caching-with-kotlin</a></p>
  
  <p>My SpringBootVersion is <code>1.5.3.RELEASE</code>
  and kotlinVersion is <code>1.1.3-2</code></p>