次の作業を行う方法は?
public abstract class MyAbstractOne {
@Cacheable(value="myCache")
public MyObject getObject() {
//some code
return object;
}
}
サブクラス
public class MySubClass extends MyAbstractOne {
@Cacheable(value="myCache")
public MyOtherObject getObjectConcrete() {
//some code
return object;
}
}
およびこれらのオブジェクトのユーザー
//from autowired instance
@Autowired MySubClass subObject;
それからどこか
//first call - may not retrieve cached objects
obj1 = subObject.getMyObject();
//second call - SHOULD retrieve a cached objects
obj2 = subObject.getMyObject();
なぜこれが失敗するのか
assertTrue(obj1.equals(obj2));
しかし、同じ getMyObjectConcrete は失敗しません。