Comment From: wilkinsona

I wonder if there's something in Framework's documentation to which we can link? If not, it would be good if something was added over there.

Comment From: mhalbritter

AFAIK there's only this JavaDoc: https://docs.spring.io/spring-framework/docs/6.0.x/javadoc-api/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.html

Comment From: mhalbritter

@sdeleuze Is it planned to add something to the SF docs?

Comment From: mhalbritter

I've written something here: https://github.com/mhalbritter/spring-boot/commit/0973a44e53a25500c711cbf1463b15328262827e

Feel free to use it if SF docs is a better place for that.

Comment From: sdeleuze

Ok yeah that makes sense, we will add that via https://github.com/spring-projects/spring-framework/issues/29350.

Comment From: santoshgangavaram

@sdeleuze I would like to create this documentation PR. Could you pls let me know if this is the document which needs to be updated?

https://github.com/spring-projects/spring-framework/blob/main/src/docs/asciidoc/web/webflux-webclient.adoc

Comment From: sdeleuze

We may or may not drop a note here, but most likely this should be documented in a dedicated section as refinment of the draft commit mentioned in https://github.com/spring-projects/spring-framework/issues/29350.

Comment From: santoshgangavaram

Got it. Would this be good to add in core-aot.adoc at the end to highlight about RegisterReflectionForBinding and ImportRuntimeHints classes?

Custom Hints
If you need to provide your own hints for reflection, resources, serialization, proxy usage etc. you can use the RuntimeHintsRegistrar API. Create a class that implements the RuntimeHintsRegistrar interface, then make appropriate calls to the provided RuntimeHints instance:

code:MyRuntimeHints

You can then use @ImportRuntimeHints on any @Configuration class (for example your @SpringBootApplication annotated application class) to activate those hints.

If you have classes which needs binding (mostly needed when serializing or deserializing JSON), you can use @RegisterReflectionForBinding on any bean. Most of the hints are automatically inferred, for example when accepting or returning data from a @RestController method. But when you work with WebClient or RestTemplate directly, you might need to use RegisterReflectionForBinding:

code:JsonSerialization

Testing custom hints
The RuntimeHintsPredicates API can be used to test your hints. The API provides methods that build a Predicate that can be used to test a RuntimeHints instance.

If you’re using AssertJ, your test would look like this:

code:MyRuntimeHintsTests

Comment From: sdeleuze

Please comment in the Spring Framework issue.

Comment From: mhalbritter

Blocked on https://github.com/spring-projects/spring-framework/issues/29350