1
votes

I have an executable JAR (not a web app being deployed to a standard container like Tomcat, etc.) that needs to connect to a DB and cache a lot of stuff.

If at all possible, I'd like to use the JCache API and inject (via Guice) the Hazelcast implementation. I will code 100% against the JCache API, so that if I ever change my mind and choose another implementation, the swap out should be (relatively) painless.

One problem: where can I get the latest stable JCache JAR?!? (What are the Maven coordinates?)

On Maven Central, all I can find are some dev JARs from 2005! So I ask: where is the JCache?

2
This question is not a dupe, shows research and is ABSOLUTELY on topic. Can someone please explain to me the reasons for both the downvote and closevote (btw, do you know when to use both of those properly)? - smeeb

2 Answers

3
votes
0
votes

If you want to use Ehcache implementations, copy/past the dependencies below:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.12</version>
</dependency>

<dependency>
    <groupId>javax.cache</groupId>
    <artifactId>cache-api</artifactId>
    <version>1.0.0</version>
</dependency>

<dependency>
    <groupId>org.ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>3.1.1</version>
    <scope>runtime</scope>
</dependency>

Find a complete example here.