https://github.com/spring-projects/spring-framework/blob/1a52c56bd42c1a9ba8cc8f8849d5f5cb742a97e5/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java#L241-L245
can call getValidationGroups()
in the InvocableHandlerMethod
construction method, and take validationGroups
returned by getValidationGroups()
method as a member variable. Avoid reflecting to obtain validationGroups
every time the call is made
Comment From: quaff
can call getValidationGroups() in the InvocableHandlerMethod construction method
You can not do that because methodValidator
is set after construction, I've fixed this by https://github.com/spring-projects/spring-framework/pull/32078
Comment From: brucelwl
can call getValidationGroups() in the InvocableHandlerMethod construction method
You can not do that because
methodValidator
is set after construction, I've fixed this by #32078
@quaff Sorry, my previous description was incorrect. I would like to correct it. Would it be better to initialize validationGroups
in method setMethodValidator(@Nullable MethodValidator methodValidator)
,
example code:
public void setMethodValidator(@Nullable MethodValidator methodValidator) {
this.methodValidator = methodValidator;
this.validationGroups = getValidationGroups();
}