Skip to content

Provide declarative AOT binding type metadata for WebMvc.fn routes #37110

Description

@mingchiuli

Proposal

Provide declarative AOT binding type metadata for WebMvc.fn routes.

WebMvc.fn handler functions expose only ServerRequest and ServerResponse.
As a result, request and response body types are not visible in handler method
signatures and cannot be discovered in the same way as annotated controllers.

Applications currently need to maintain a separate list such as:

@RegisterReflectionForBinding({
    CreateRequest.class,
    Result.class,
    UserResponse.class
})

This is easy to forget when adding or changing a route.

Would Spring Framework consider adding a typed declaration mechanism to the
WebMvc.fn router or response builder, allowing request and response binding
types (including ParameterizedTypeReference) to be associated with a route
and processed automatically during AOT?

The goal is not to analyze arbitrary handler bytecode, but to provide an
official declarative API colocated with each functional route.

This could potentially also be considered for WebFlux.fn for API parity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: waiting-for-triageAn issue we've not yet triaged or decided ontheme: aotAn issue related to Ahead-of-time processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions