spring - Spiring @Cacheable is not working -


i have added <cache:annotation-driven /> in spring applicationcontext.xml.

also added

<bean id="cachemanager" class="org.springframework.cache.support.simplecachemanager">         <property name="caches">             <set><bean class="org.springframework.cache.concurrent.concurrentmapcachefactorybean" name="executecachedmethod" /> </set></property></bean> 

added @cacheable before method make database call using jdbctemplate.

whenever makes call method same parameter method executed , goes database. supposed me cached result. help?

actually using in spring bean during startup. spring implementation @cacheable work after cacheinterceptor.aftersingletonsinstantiated() call made. in case using before that.

so testing

@autowired cacheinterceptor cacheinterceptor; 

just test cache while load if purposefully (not recommended) make call cacheinterceptor.aftersingletonsinstantiated(), cache work.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -