为什么@Cacheable注释会导致java.lang.IllegalArgumentException?

时间:2017-05-11 09:13:59

标签: java spring rest caching

我刚刚将@Cacheable(value = "testCaching", key = "#id")添加到@RestController中的方法中,如下所示:

  @Cacheable(value = "testCaching", key = "#id")
  public Book getCachedMsg(@PathVariable("id") final int id, final HttpServletResponse response)

并收到以下错误:

java.lang.IllegalArgumentException: Name for argument type [int] not available, and parameter name information not found in class file either.

有人知道原因吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

ctx.addAttributeValue("member", userDn.toString());