-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time to live not set when using save when using @PostConstruct
#458
Comments
Sounds like a bug! Did you just used |
yes i used repository.save |
hello @bsbodden for saveAll also has issue i guess. the controller save() has TTL set. |
@GohKianSeng I can't seem to be able to replicate the issue, could you create a simple reproducer app? Just models, repository and a CommandLineRunner to run your scenario? |
@PostConstruct
@GohKianSeng I don't think we have added support for |
Hi @bsbodden, I discovered that in a Spring Boot project, when using spring-boot-devtools, the application runs with the org.springframework.boot.devtools.restart.classloader.RestartClassLoader class loader, instead of the jdk.internal.loader.ClassLoaders class loader (which is used by Spring OM). This difference causes an issue where Spring OM cannot load the KeyspaceConfiguration for an entity in the method:
The problem arises because the line:
returns an entityClassKey that is not present in the KeyspaceConfiguration.settingsMap In the context of @SpringBootTest, the jdk.internal.loader.ClassLoaders class loader is used, which is why TTL works in the unit test environment, but fails in the application context when spring-boot-devtools is enabled. A temporary fix for this issue is to disable spring-boot-devtools. |
@nexlink-giangbui thanks for the investigation! The RestartClassLoader getting in the way of low level stuff is a recurring theme, I'm looking into ways to get to the correct classloader in that scenario. Stay tuned! |
hello this is my entity model.
set the time to live but in redis insight, show no limit.
`@Document("TestResultRedis", timeToLive = 5 * 60)
data class TestResultRedisModel(
@id
val id: Long?,
)`
The text was updated successfully, but these errors were encountered: