I am a beginner and learning springboot

springboot 3.2+ WebDataBinder getTarget() get request returns null

@InitBinder public final void dataBinder(WebDataBinder binder) { if (binder.getTarget() instanceof BaseCondition baseCondition) { binder.addValidators(baseCondition); } }

binder.getTarget() == null; Version 3.1.12 is available

public interface BaseCondition extends Validator {

}

public class LoginCondition implements BaseCondition {

}

Comment From: liua1004

binder.getTarget() will be null if your controller method has a simple type parameter.

Comment From: attachmentList

binder.getTarget() will be null if your controller method has a simple type parameter.

public String test111(@Valid LoginCondition condition) {
    System.out.println("condition = " + condition);
    return "test";
}

我想实现统一参数验证,目前这种方式 get 请求binder.getTarget() == null, post 是ok的

Comment From: bclozel

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.