I'm using a configuration base on xml. How can I translate this java code to xml?
@Bean
public CacheManager cacheManager() {
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
GuavaCache cache1 = new GuavaCache("book", CacheBuilder.newBuilder().build());
GuavaCache cache2 = new GuavaCache("books", CacheBuilder.newBuilder()
.expireAfterAccess(30, TimeUnit.MINUTES)
.build());
simpleCacheManager.setCaches(Arrays.asList(cache1, cache2));
return simpleCacheManager;
}
I have this, but I got stuck:
<bean id="cacheManager" class="org.springframework.cache.guava.GuavaCacheManager">
<property name="caches">
<list>
<ref bean="cache1"/>
<ref bean="cache2"/>
</list>
</property>
</bean>
<bean id="cache1" class="org.springframework.cache.guava.GuavaCache">
<constructor-arg value="book" />
<constructor-arg refer="foo" />
</bean>
<bean id="cahe1Settings" class="com.google.common.cache.CacheBuilder" factory-method="newBuilder">
</bean>
<bean id="foo" factory-bean="cahe1Settings" factory-method="build"/>
No comments:
Post a Comment