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
Post a Comment