Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention @RegisterReflectionForBinding in the docs #32903

Closed
mhalbritter opened this issue Oct 27, 2022 · 10 comments
Closed

Mention @RegisterReflectionForBinding in the docs #32903

mhalbritter opened this issue Oct 27, 2022 · 10 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@mhalbritter
Copy link
Contributor

No description provided.

@mhalbritter mhalbritter added the type: documentation A documentation update label Oct 27, 2022
@mhalbritter mhalbritter added this to the 3.0.x milestone Oct 27, 2022
@mhalbritter mhalbritter self-assigned this Oct 27, 2022
@mhalbritter mhalbritter changed the title Mention @RegisterReflectionForBinding in the docs. Mention @RegisterReflectionForBinding in the docs Oct 27, 2022
@wilkinsona
Copy link
Member

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.

@mhalbritter
Copy link
Contributor Author

@mhalbritter
Copy link
Contributor Author

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

@mhalbritter
Copy link
Contributor Author

I've written something here: mhalbritter@0973a44

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

@sdeleuze
Copy link
Contributor

Ok yeah that makes sense, we will add that via spring-projects/spring-framework#29350.

@santoshgangavaram
Copy link

@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

@sdeleuze
Copy link
Contributor

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 spring-projects/spring-framework#29350.

@santoshgangavaram
Copy link

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

@sdeleuze
Copy link
Contributor

Please comment in the Spring Framework issue.

@mhalbritter mhalbritter added the status: blocked An issue that's blocked on an external project change label Nov 2, 2022
@mhalbritter
Copy link
Contributor Author

Blocked on spring-projects/spring-framework#29350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

4 participants