Migrate hint registration to shortcuts

Migrate code to make use of the `MemberCategory` and `FieldMode`
shortcuts.

See gh-29011
This commit is contained in:
Phillip Webb
2022-09-01 16:30:25 -07:00
parent bc0bf1fac3
commit 505da5c602
17 changed files with 147 additions and 198 deletions

View File

@@ -85,8 +85,7 @@ class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProc
return;
}
for (Class<?> proxyInterface : proxyInterfaces) {
runtimeHints.reflection().registerType(proxyInterface,
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_METHODS));
runtimeHints.reflection().registerType(proxyInterface, MemberCategory.INVOKE_DECLARED_METHODS);
}
}
}

View File

@@ -19,6 +19,7 @@ package org.springframework.transaction.annotation;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeHint;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.hint.support.RuntimeHintsUtils;
import org.springframework.transaction.TransactionDefinition;
@@ -37,7 +38,8 @@ class TransactionRuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
RuntimeHintsUtils.registerSynthesizedAnnotation(hints, Transactional.class);
hints.reflection().registerTypes(TypeReference.listOf(
Isolation.class, Propagation.class, TransactionDefinition.class),
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS));
Isolation.class, Propagation.class, TransactionDefinition.class),
TypeHint.builtWith(MemberCategory.DECLARED_FIELDS));
}
}