2016-09-27 12 views
1

アプリケーションをJboss 4.2.2/java 6/Spring 2.5.4からWildfly 9.0.2/java 8/Spring 4.3.2にアップグレードしています。ehcache:proxyをspring4に移行する

Spring/Ehcacheは、インターフェイスとワークフローに多くの変更を加えました。私のxmlがもはや正しくない理由に関する情報は見つかりません。

私はとの問題を抱えている宣言:

<ehcache:proxy id="itemDaoCacheProxy" refId="itemDao"> 
    <ehcache:caching methodName="getAllItemNo" cacheName="itemTableCache" /> 
</ehcache:proxy> 

エラーメッセージ:

コンテキストの初期化に失敗しました:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:ライン98でServletContextリソース[/WEB-INF/spring-cfg.xml]のXMLドキュメントが無効です。ネストされた例外はorg.xml.sax.SAXParseExceptionです。 lineNumber:98; columnNumber:54; cvc-complex-type.2.4.c:一致するワイルドカードは厳密ですが、要素 'cache:proxy'の宣言は見つかりません。

私のXML宣言は次のようになります。

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:cache="http://www.springframework.org/schema/cache" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-4.3.xsd 
     http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-4.3.xsd 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx/spring-tx-4.3.xsd 
     http://www.springframework.org/schema/cache 
     http://www.springframework.org/schema/cache/spring-cache.xsd"> 

私はchacheユーティリティの春-コンテキストsupport.jarを使用していますが、問題は、XMLファイルとスキーマに孤立しているようです。 "プロキシ"要素は、後のバージョンでは見えなくなっているようです。

旧:

https://github.com/zznate/spring-modules-ehcache/blob/master/src/main/java/org/springmodules/cache/config/ehcache/springmodules-ehcache.xsd

新:

http://www.springframework.org/schema/cache/spring-cache.xsd

exacly ehcacheを何:プロキシは、私は新しいにこれをどのように移行することができないと標準?

よろしくお願いいたします。

答えて

1

この投稿は、システムの移行に使用した方法を詳しく説明しています。

http://springtips.blogspot.se/2007/06/caching-methods-result-using-spring-and_23.html

<bean id="itemDaoCacheProxyMethodCache" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> 
    <property name="advice"> 
     <bean id="methodCacheInterceptor" class="com.myproject.mymodule.MethodCacheInterceptor"> 
      <property name="cache"> 
       <bean id="methodCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> 
        <property name="cacheManager"> 
         <ref bean="ehcache"/> 
        </property> 
        <property name="cacheName"> 
         <value>itemTableCache</value> 
        </property> 
       </bean> 
      </property> 
     </bean> 
    </property> 
    <property name="mappedName" value="getAllItemNo"/> 
</bean> 

<bean id="itemDaoCacheProxy" class="org.springframework.aop.framework.ProxyFactoryBean"> 
    <property name="target" ref="itemDao"/> 
    <property name="interceptorNames"> 
     <list> 
      <value>itemDaoCacheProxyMethodCache</value> 
     </list> 
    </property> 
</bean> 

何のコードが行うことは、それは私のクラスをラップし、指定された関数のキャッシュ機能を実装する新しいコンテナを作成しています。

これは、クラスのインスタンスの中には、キャッシュされた応答を確認/更新するインスタンスと、キャッシュされないレスポンスを更新するインスタンスが存在する可能性があることを意味します。

関連する問題