How to programmatically initialize redisson hibernate second level cache
See original GitHub issueMy application uses:
org.redisson:redisson-hibernate-53:3.13.6
org.redisson:redisson:3.13.1
org.redisson:redisson-spring-data-22:3.12.5
id 'org.springframework.boot' version '2.3.0.RELEASE'
I am using spring boot along with redisson for http session management and spring data. The configuration is programmatically initialized and works well.
I am trying to add hibernate 2nd level cache back by redis. I cannot find documentation on how this can be done programmatically. I have the following beans: RedissonClient
, RedissonConnectionFactory
and RedisTemplate
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Problem with Redisson Hibernate 2L cache config in Spring ...
To initialize a RedissionClient in Java code you need to create a CustomRegionFactory extending RedissonRegionFactory, then override the ...
Read more >What is the Hibernate second-level cache? - Redisson
The Hibernate first-level cache is associated with a Hibernate Session object, which represents the connection between a Java application and a SQL database....
Read more >Hibernate Second-Level Cache - Baeldung
In this article, we learned how to set up a Hibernate second-level cache. Hibernate is fairly easy to configure and use, making second-level ......
Read more >Implementing a Cache with Spring Boot - Reflectoring
Spring provides an abstraction layer for implementing a cache. ... Another option is to configure the cache programmatically via Spring's ...
Read more >hibernate-redis - Bountysource
How to configure hibernate second level and spring cache the same redissonclient? My solution is access redissonClient after initialized ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mrniko Yes I see that but even adding a default constructor in
RedissonPersistenceCachingConfiguration
doesn’t help since whenRedissonRegionFactory#prepareForUse
is called the Overriden methodcreateRedissonClient
returnsnull
since theRedissonClient
is never injected.Mainly what I am trying to do is have
RedissonRegionFactory
use theRedissonClient
which already has been created (I have already created one for spring sessions).RedissonRegionFactory
looks to only support creating a client from properties rather than reusing one if it already exists as a beanDo you have an example of this? I keep reading about it, but I don’t see any examples. Maybe I haven’t looked deep enough