2017-05-11 6 views
0

私は、次のよう@RestControllerでMethodeのに@Cacheable(value = "testCaching", key = "#id")を追加しました:@Cacheableアノテーションがjava.lang.IllegalArgumentExceptionにつながるのはなぜですか?

@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. 

誰もが理由を知っているの?

+0

あなたは "キー= ID" で試されますか? – cralfaro

+0

あなたは#を削除することを意味します。はい、私もそれをして、同じエラーが発生しました! –

+0

コントローラのメソッドにcacheableを追加しているために問題が多分あるかもしれません。コントローラーからキャッシュ可能なアノテーションを含むサービスを呼び出す方が良いかもしれません。それを試すことができますか? – cralfaro

答えて

0

はこれを試してみてください:

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

は動作しません! –

関連する問題