I have a class Savings that contains the info input by the user in a form:
public class Savings{
private int numberOfTimes;
private double value;
...
}
and a controller that calls the validator () method from the Spring Validator Interface for the validation of those inputs:
public class blablablaController {
@Autowired
private int todaysMaxValue;
@PostMapping(path = { "/blablabla" })
public String submit(@ModelAttribute("savings") Savings savings, BindingResult result, ModelMap model) {
SavingsValidator sv= new SavingsValidator ();
sv.validate(savings, result);
}
}
The issue is that I need to make sure that the value of the user inputs does not exceed the certain ammound, "todaysMaxValue", that is external to the Class SavingsValidator