Java Spring 3.1.1和缓存配置问题
我正在测试Spring缓存,这是我的上下文文件Java Spring 3.1.1和缓存配置问题,java,eclipse,spring,caching,jakarta-ee,Java,Eclipse,Spring,Caching,Jakarta Ee,我正在测试Spring缓存,这是我的上下文文件 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" xsi:schemaLocation= "http://www.spr
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<cache:annotation-driven cache-manager="simpleCacheManager"/>
<bean id="simpleCacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
<set>
<bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean">
<property name="name" value="alfresco"/>
</bean>
<bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean">
<property name="name" value="alfresco_article"/>
</bean>
<bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean">
<property name="name" value="alfresco_action"/>
</bean>
</set>
</property>
</bean>
aop-alliance.jar和org.springframework.aop-3.1.1.RELEASE.jar都在类路径中
有线索吗
谢谢,Andrea仔细检查org.springframework.context-3.1.1.RELEASE.jar是否确实在类路径上。Eclipse验证和错误都指向了这个问题 更新:我查过了,你是对的
ConcurrentCacheFactoryBean
似乎从3.1.0.M1开始被删除,并可能被同一软件包中的ConcurrentMapCacheFactoryBean
替换。我还没有在发行说明中找到任何证据。但是,如果您将缓存的bean类名更改为ConcurrentMapCacheFactoryBean
,它似乎工作正常
<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
<property name="name" value="alfresco"/>
</bean>
更新2:是的,事实上,
ConcurrentCacheFactoryBean
已经到了ConcurrentMapCacheFactoryBean
他们只是没有抽出时间来更新教程。是的,它是有效的,但仍然是java.lang.ClassNotFoundException:org.springframework.aop.config.AopNamespaceUtils。有没有可能其他东西已经改变了?该类在classpathAopNamespaceUtils
上可用,应该在您的spring-aop-3.1.1.RELEASE.jar中-确保包含它。此外,这与缓存配置没有多大关系;-)springaop
取决于aopalliance-1.0.jar
。确保你有它。
<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
<property name="name" value="alfresco"/>
</bean>