【发布时间】:2016-10-23 00:24:21
【问题描述】:
我正在为 maven 多模块项目进行缓存实现(exstremescale),我在 maven 依赖项下面添加了
<dependency>
<groupId>com.ibm.extremescale</groupId>
<artifactId>ogclient</artifactId>
<version>8.6.0.20150901-215917</version>
</dependency>
在
上添加了缓存注释@Override
@Cacheable(value = "productDetails", key = "#productId + #orgId")
public Product productRead(final String productId, final String productKey, final String orgId, final CRApplicationEnum sourceSystem) throws IntegrationException {
缓存管理器.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
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 />
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager" primary="true">
<property name="caches">
<set>
<bean class="com.ibm.websphere.objectgrid.spring.ObjectGridCache"
p:name="eventDetails" p:map-name="${iev.eventDetails.mapName}"
p:object-grid-client-ref="wxsGridClient" />
<bean class="com.ibm.websphere.objectgrid.spring.ObjectGridCache"
p:name="eventValidationDetails" p:map-name="${iev.eventValidationDetails.mapName}"
p:object-grid-client-ref="wxsGridClient" />
<bean class="com.ibm.websphere.objectgrid.spring.ObjectGridCache"
p:name="productDetails" p:map-name="${ipr.productDetails.mapName}"
p:object-grid-client-ref="wxsGridClient" />
</set>
</property>
</bean>
<bean id="wxsCSDomain"
class="com.ibm.websphere.objectgrid.spring.ObjectGridCatalogServiceDomainBean"
p:catalog-service-endpoints="${xscale.catalogServiceEndpoint}" />
<bean id="wxsGridClient"
class="com.ibm.websphere.objectgrid.spring.ObjectGridClientBean"
p:catalog-service-domain-ref="wxsCSDomain" p:objectGridName="${wxs.objectGridName}" />
缓存仅适用于项目的一个 maven 模块,我可以看到缓存拦截器调用,而对于 maven 模块的其余部分,它忽略了 @cacheable 注释(它不会进入拦截器)。
我们没有PostConstructor 或Self invokation
我们使用 atomikos 作为事务管理器和 CXF 拦截器,它们将在缓存方法之前执行。
请帮帮我
【问题讨论】:
-
在模块上工作而不是在其他模块上工作我会说有点奇怪。 Spring 应用程序上下文不关心你的类是从哪里加载的。您是否使用父/子上下文?
-
在调试过程中我们了解到,JdkDynamicAopProxy 类为具有可缓存注解的 bean 准备的拦截器列表并没有将缓存拦截器添加到列表中。
-
你能分享一个样本吗,这样会容易得多。你能显示那个bean的bean配置吗?你是否有机会暴露一个接口?
标签: java spring caching spring-cache