Spring framework has a very nice @Cacheable annotation. Is there a way to reproduce this functionality in a Java EE application by using @Interceptors and ehCache?
There is JSR-107, standardising a Java Cache API. This was scheduled to be included in Java EE 7, but will not make it in time according to the latest announcements.
Anyway, I tried the reference implementation in Dec. 2012, and it worked fine for me after applying two minor pull requests and building it locally. I didn't try it with ehCache, though.
There are annotations that work with CDI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With