spring-data-mongodb
spring-data-mongodb copied to clipboard
Can't (still) use properties in `@Indexed#expireAfter`
Following #4672, #2369 and Spring Data 2024.0 Release, I expected to be able to use property placeholders in @Indexed#expireAfter.
However, this is still not possible. SpEL expressions #{...} work, as well as bean references #{@bean.method()}, but using properties ${...} results in an exception: '${ttl}' is not a valid duration, cannot detect any known style.
Minimal sample: https://github.com/gbaso/spring-data-mongodb-ttl.
thanks for the heads up, seems we'd need to obtain the ValueEvaluationContext in MongoPersistentEntityIndexResolver:663 instead of just the EvaluationContext.
Hello, if no one is currently working on this issue, may I give it a try?
I’m planning to create a new method getValueEvaluationContextForProperty that returns a ValueEvaluationContext, as suggested by @christophstrobl
I will also add a test to confirm that the issue is resolved.