Skip to content

Commit

Permalink
fix: RetryTemplate aot hints
Browse files Browse the repository at this point in the history
  • Loading branch information
klopfdreh committed Sep 16, 2024
1 parent b98b2a5 commit 12cad57
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>.</directory>
<targetPath>META-INF</targetPath>
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/springframework/retry/aot/RetryHints.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.springframework.retry.aot;

import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.retry.support.RetryTemplate;

/**
* The retry runtime hints to be used for aot builds.
*
* @author Tobias Soloschenko
*/
class RetryHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.reflection()
.registerType(TypeReference.of(RetryTemplate.class),
hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INTROSPECT_DECLARED_METHODS,
MemberCategory.INVOKE_DECLARED_METHODS));
}

}
2 changes: 2 additions & 0 deletions src/main/resources/META-INF/spring/aot.factories
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.retry.aot.RetryHints

0 comments on commit 12cad57

Please sign in to comment.