Spring, Infinispan and JBoss 7 integration

◇◆丶佛笑我妖孽 提交于 2019-12-05 19:36:27

If each application are using there own cache manager, they will have separated cached.

You can retrieve the cache container managed by the application server via JNDI support of Spring (The JNDI name is java:jboss/infinispan/my-container-name). So Spring will be responsible to make sure every part are using the same container.

I am not 100% sure you will get the same cache, it may return you a application specific cache (the 2 applications data object are in fact coming from different class loader).

Embedded cache is probably not mean for inter application communication. You probably need to use the client/server paradigm.

Stelios Koussouris

A bit late in the day but the information on accessing the infinispance cache store via JNDI can be found here

With that a JNDI lookup I get the CacheContainer

<jee:jndi-lookup id="cache1" 
    jndi-name="java:jboss/infinispan/container/jbossas7-quickstart" 
    cache="true" resource-ref="false" lookup-on-startup="true" />

which I inject via a setter

public void setContainer(CacheContainer container) {
    this.container = container;
}

and now I have access to the cachestore. Note the suggestions here

@Resource(lookup="java:jboss/infinispan/container/my-container-name")
@Resource(lookup="java:jboss/infinispan/cache/my-container-name/my-cache-name")

do not work within my Spring Bean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!