question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to programmatically initialize redisson hibernate second level cache

See original GitHub issue

My 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:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
smirandamedalliacommented, Dec 4, 2020

@mrniko Yes I see that but even adding a default constructor in RedissonPersistenceCachingConfiguration doesn’t help since when RedissonRegionFactory#prepareForUse is called the Overriden method createRedissonClient returns null since the RedissonClient is never injected.

Mainly what I am trying to do is have RedissonRegionFactory use the RedissonClient 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 bean

0reactions
moose-bytecommented, Mar 25, 2022

Do 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found