Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@Cacheable in Java EE

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?

like image 687
vasily Avatar asked Jun 05 '26 00:06

vasily


1 Answers

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.

like image 55
Harald Wellmann Avatar answered Jun 08 '26 00:06

Harald Wellmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!