Closed
Description
I use org.springframework.vault:spring-vault-core:3.0.3
and have faced an issue that keyspace is always set to simple class name and value from annotation KeySpace is ignored.
Looks like the reason for this in org.springframework.data.keyvalue.core.mapping.BasicKeyValuePersistentEntity
constructor updates
It was
public BasicKeyValuePersistentEntity(TypeInformation<T> information,
@Nullable KeySpaceResolver fallbackKeySpaceResolver) {
super(information);
Class<T> type = information.getType();
String keySpace = AnnotationBasedKeySpaceResolver.INSTANCE.resolveKeySpace(type);
if (StringUtils.hasText(keySpace)) {
this.keyspace = keySpace;
this.keyspaceExpression = detectExpression(keySpace);
} else {
this.keyspace = resolveKeyspace(fallbackKeySpaceResolver, type);
this.keyspaceExpression = null;
}
}
Now it is
public BasicKeyValuePersistentEntity(TypeInformation<T> information, @Nullable KeySpaceResolver keySpaceResolver) {
this(information, keySpaceResolver != null ? keySpaceResolver.resolveKeySpace(information.getType()) : null);
}
At the same time the signature for org.springframework.vault.repository.mapping.VaultMappingContext::createPersistentEntity
did not changed.
See
@Override
protected <T> VaultPersistentEntity<?> createPersistentEntity(TypeInformation<T> typeInformation) {
return new BasicVaultPersistentEntity<>(typeInformation, this.fallbackKeySpaceResolver);
}
It leads to situation when fallback key space resolver is always used which is SimpleClassNameKeySpaceResolver
.
I run it during Spring Boot 3.1 upgrade, works fine with Spring Boot 2.7.5.