Skip to content

Can't (still) use properties in @Indexed#expireAfter #4980

@gbaso

Description

@gbaso
Contributor

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.

Activity

christophstrobl

christophstrobl commented on May 23, 2025

@christophstrobl
Member

thanks for the heads up, seems we'd need to obtain the ValueEvaluationContext in MongoPersistentEntityIndexResolver:663 instead of just the EvaluationContext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @christophstrobl@gbaso@spring-projects-issues

      Issue actions

        Can't (still) use properties in `@Indexed#expireAfter` · Issue #4980 · spring-projects/spring-data-mongodb