add a @Produces for cacheManager and get directly the CacheManager injected ;)

CacheBean is then just the producer bean completely hidden from the
other parts of app :)

Allows to keep the lifecycle handling in CacheBean (close() calls)

Romain Manni-Bucau
@rmannibucau |  Blog | Github | LinkedIn | Tomitriber


2015-11-18 13:25 GMT-08:00 sgjava <sgj...@gmail.com>:
> I used:
>
>     @Inject
>     public JCacheResolverFactory(final CacheBean cacheBean) {
>         cacheManager = cacheBean.getCacheManager();
>     }
>
> Then it can share the same CacheManager from the CacheBean:
>
>     @PostConstruct
>     public void init() {
>         cachingProvider = Caching.getCachingProvider();
>         cacheManager = cachingProvider.getCacheManager(new File(
>                 "src/config/ehcache.xml").toURI(), CacheBean.class.
>                 getClassLoader());
>     }
>
>
>
>
> --
> View this message in context: 
> http://tomee-openejb.979440.n4.nabble.com/Getting-CacheManager-from-CacheResolverFactory-tp4676849p4676851.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to