Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement second-level caching in Spring Boot 3 using Ehcache 3?

I've been trying to find a way to implement second-level caching using Spring Boot 3 + Ehcache 3 + Hibernate 6 but it's been an unsuccessful ride so far.

I tried looking it up on the internet but no tutorial exists. Maybe I'm the first one?

Edit: Basically the issue is with dependencies. Spring Boot 3 needs Jakarta but Ehcache is using Javax. There are also lots of unavailable dependencies from EhCache 3. Forcing everything together just does not work.

Can anyone help?

like image 647
HyperX Pro Avatar asked Jun 11 '26 18:06

HyperX Pro


1 Answers

Starting with Ehcache version 3.10 there's a Jakarta EE version which you can declare like this in Spring Boot 3.x projects:

<dependency>
  <groupId>org.ehcache</groupId>
  <artifactId>ehcache</artifactId>
  <classifier>jakarta</classifier>
</dependency>

See https://github.com/ehcache/ehcache3/releases/tag/v3.10.0.

like image 71
Maarten1985 Avatar answered Jun 15 '26 07:06

Maarten1985



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!