The @GetMapping endpoint specified in this comment triggers this error:

java.lang.IllegalStateException: No primary or single unique constructor found for class com.example.validation.NoteFilters
        at org.springframework.beans.BeanUtils.getResolvableConstructor(BeanUtils.java:266) ~[na:na]
        at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:219) ~[validation:6.0.0-SNAPSHOT]
        at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:85) ~[na:na]
        at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:147) ~[validation:6.0.0-SNAPSHOT]

ControllerMappingReflectiveProcessor should potentially be updated to add contructor hints on parameters without recognized annotation or with @ModelAttribute annotation.

Comment From: sdeleuze

The logic to support this use case is quite involved and the simplified one we have currently implemented in ControllerMappingReflectiveProcessor#registerParameterTypeHints won't be able to cover this usage of ServletModelAttributeMethodProcessor in catch-all mode configured in RequestMappingHandlerAdapter#getDefaultArgumentResolvers.

A solution discussed with @rstoyanchev yesterday and previously with @snicoll would be to reuse the logic from RequestMappingHandlerAdapter#getDefaultArgumentResolvers but we would have to provide different implementations for WebFlux versus WebMVC and adapt the hint after evaluating the argument resolver returned. Doable but involved so I move this issue in the 6.0.x bucket.

In the meantime, users can use @RegisterReflectionForBinding(Foo.class) (see related Javadoc) to add the relevant hints.

Comment From: sdeleuze

This issue is tightly related to #31765, we now document this native limitation in Spring Framework reference documentation and Spring Boot wiki. I tend to think the maintenance burden of implementing what is described in the comment above is not necessarily worth the effort, so I prefer to close this issue and reconsider only if there is a strong ask from various users.

Conceptually, native require to have a more explicit programming model, and asking native users to use the explicitly @ModelAttribute to infer related hints does not sound an unreasonable ask to me.