1
スプリングデータのmongoリポジトリで@Cacheableアノテーションを使用できるかどうかは疑問でした。たとえば、次のようになります。SpringのMongoDB統合で@Cacheableを使用したキャッシングspringブートとredisでの
public interface UserRepository extends MongoRepository<User, String> {
@Cacheable("byId")
public interface UserRepository extends MongoRepository<User, String> {
User findById(String id);
}
}
可能であれば、インターフェイスクラス自体でそれを行いたい場合は、ラッパークラスを使用しないでください。さらに、Java config(xmlではない)でredisのキャッシュ設定を行う方法のサンプルがありますか?