Spring boot does not take effect when using @ size to verify a single set parameter of the control layer

Spring boot does not take effect when using @ size to verify a single set parameter of the control layer

1. Problem description

In the figure below, there is a type of List & lt; String> method parameter, when using @ size to mark the verification quantity, it is found that no exception is thrown

2. Solution

You need to add the @ validated annotation on the control class, and restart the project


Read More: