Spring のキャッシング アノテーションを使用しています。applicationContextfile からキャッシュ [@CacheEvict(name="vendorCache")] の名前を渡したい、または他の方法で構成できます。
今、VendorDAo と NetworkDao の 2 つのクラスがあるシナリオがあります。
public VenderDAO
{
@CacheEvict(name="vendorCache")
public String insert():void
{
//code to add the record into the table using ibatis
}
}
public NetworkDao
{
@CacheEvict(name="netWorkCache")
public String insert():void
{
//code to add the record into the table using ibatis
}
}
今ではいくつかのメソッドがありますが、唯一の違いは @CacheEvict です。構成ファイルでキャッシュ名を宣言し、Bean にプロパティとして渡す方法はありますか。
<bean id="venderDAO" class="VenderDAO">
<property name="cachename" value="vendorCache"/>
</bean>
<bean id="netWorkDAO" class="VenderDAO">
<property name="cachename" value="netWorkCache"/>
</bean>
[Note: both the beans have the same class name]
これをJavaファイルで使用できます。または、他の方法があります。どんな指針も高く評価されます。
よろしく
ラージ