Skip to content

expiryExpression ignored, but expiry works [DATACOUCH-645] #956

Closed
@spring-projects-issues

Description

@spring-projects-issues

jpringle opened DATACOUCH-645 and commented

4.1 fixed things so that this now works:

@Document(expiry = 120)

But expiryExpression is ignored

@Document(expiryExpression = "${token.expiry.seconds}")

 

Possibly due to method ReactiveUpsertByIdOperationSupport.buildUpsertOptions() only inspecting the annotation attribute for expiry

 

private UpsertOptions buildUpsertOptions() {
	final UpsertOptions options = UpsertOptions.upsertOptions();
	if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE) {
		options.durability(persistTo, replicateTo);
	} else if (durabilityLevel != DurabilityLevel.NONE) {
		options.durability(durabilityLevel);
	}
	if (expiry != null && !expiry.isZero()) {
		options.expiry(expiry);
	} else if (domainType.isAnnotationPresent(Document.class)) {
		Document documentAnn = domainType.getAnnotation(Document.class);
		long durationSeconds = documentAnn.expiryUnit().toSeconds(documentAnn.expiry());
		options.expiry(Duration.ofSeconds(durationSeconds));
	}
	return options;
}

Affects: 4.1 GA (2020.0.0)

1 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions