Spring Cache Abstraction VS interfaces VS key param (“Null key returned for cache operation” error)

后端 未结 1 764
栀梦
栀梦 2021-01-12 07:02

While implementing, I came across a problem with Spring Cache Abstraction VS interfaces. Lets say I have the following interface:

package com.example.cache;         


        
1条回答
  •  没有蜡笔的小新
    2021-01-12 07:51

    My guess is that for jdk proxy the parameter name is fetched from the interface method so it's key and not keyTwo.

    update: You can try to use parameter indexes instead

    If for some reason the names are not available (ex: no debug information), the parameter names are also available under the p<#arg> where #arg stands for the parameter index (starting from 0).

    see http://static.springsource.org/spring/docs/3.1.0.M1/spring-framework-reference/html/cache.html#cache-spel-context

    0 讨论(0)
提交回复
热议问题