के लिए ईएचसीएच को कॉन्फ़िगर करना मैं मौजूदा स्प्रिंग 3.1.1 एप्लिकेशन में ऑब्जेक्ट कैशिंग को हाइबरनेट 3.5.5 के साथ सक्षम करने का प्रयास कर रहा हूं। मैं ehcache 2.2.0 का उपयोग कर रहा हूँ। मेरे एप्लिकेशन में कॉन्टैक्ट I ने EHCache के साथ कैशिंग पर स्विच करने के लिए कॉन्फ़िगरेशन जोड़ा है।स्प्रिंग 3.1.1 और हाइबरनेट
<cache:annotation-driven />
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
p:cache-manager="ehcache" />
<bean id="ehcache"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:config-location="ehcache.xml" />
मैं तो ehcache.xml फ़ाइल बनाई:
<diskStore path="java.io.tmpdir" />
<defaultCache
eternal="false"
maxElementsInMemory="1000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
memoryStoreEvictionPolicy="LRU"/>
<cache name="studentCache"
eternal="false"
maxElementsInMemory="10000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
memoryStoreEvictionPolicy="LRU" />
मैं ehcache के लिए pom.xml फ़ाइल में आवश्यक निर्भरता गयी। लेकिन अब मुझे यह त्रुटि मिल रही है:
Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'net.sf.ehcache.CacheManager' for property 'cacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [net.sf.ehcache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy found
क्या किसी को यह पता है कि इसका क्या कारण है?
तुम्हारा काम करना चाहिए ... यहाँ मेरे कार्य विन्यास अगर यह होता है मदद करता है: <कैश: एनोटेशन-संचालित /> <बीन आईडी = "कैश मैनेजर" वर्ग = "org.springframework.cache.ehcache.EhCacheCacheManager"> <संपत्ति नाम = "cacheManager"><रेफरी स्थानीय = "ehcache" /> <सेम आईडी = "ehcache" class = "org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p: configLocation = "classpath: ehcache .xml "/> – aweigold
@aweigold धन्यवाद। ऐसा लगता है कि किसी कारण से काम करना प्रतीत होता है। मैं संपत्ति तत्व खो रहा था। आप अपनी टिप्पणी को उत्तर के रूप में क्यों नहीं जोड़ते हैं ताकि मैं इसे स्वीकार कर सकूं। –
कूल, खुशी हुई कि मदद की। – aweigold