spring-projects / spring-projects/spring-framework

Provide declarative AOT binding type metadata for WebMvc.fn routes

Open
#37,110 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: web status: waiting-for-triage theme: aot
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the WebMvc.fn router and response-builder entry points, then compare their AOT handling with annotated controllers. Determine the scope of a declarative route-level API, including ParameterizedTypeReference and possible WebFlux.fn parity; done means the agreed metadata is processed automatically during AOT.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.