From a22bb12e75cb7c9a0cb7fbd52576e34cafafb579 Mon Sep 17 00:00:00 2001 From: Olga MaciaszekSharma Date: Mon, 26 Jun 2023 17:53:59 +0200 Subject: [PATCH] Add missing reflection hints for EncryptionBootstrapConfiguration. Fixes gh-1245. --- .../encrypt/EncryptionBootstrapConfiguration.java | 14 ++++++++++++++ .../main/resources/META-INF/spring/aot.factories | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 spring-cloud-context/src/main/resources/META-INF/spring/aot.factories diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EncryptionBootstrapConfiguration.java b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EncryptionBootstrapConfiguration.java index b43bc0d4..ee25d77e 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EncryptionBootstrapConfiguration.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EncryptionBootstrapConfiguration.java @@ -16,6 +16,9 @@ package org.springframework.cloud.bootstrap.encrypt; +import org.springframework.aot.hint.MemberCategory; +import org.springframework.aot.hint.RuntimeHints; +import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; @@ -142,4 +145,15 @@ public class EncryptionBootstrapConfiguration { } + class EncryptionHints implements RuntimeHintsRegistrar { + + @Override + public void registerHints(RuntimeHints hints, ClassLoader classLoader) { + hints.reflection().registerTypeIfPresent(classLoader, + "org.springframework.security.rsa.crypto.RsaSecretEncryptor", + MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); + } + + } + } diff --git a/spring-cloud-context/src/main/resources/META-INF/spring/aot.factories b/spring-cloud-context/src/main/resources/META-INF/spring/aot.factories new file mode 100644 index 00000000..8663a91e --- /dev/null +++ b/spring-cloud-context/src/main/resources/META-INF/spring/aot.factories @@ -0,0 +1,2 @@ +org.springframework.aot.hint.RuntimeHintsRegistrar=\ +org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration.EncryptionHints \ No newline at end of file