I have a Spring controller that accepts one of my business objects as an argument, that spring is automatically building from form data. One of the attributes of the object is an enum that comes from a select dropdown in the form. I am also using the @Valid notation to do validation on the object, using an implementation of the Spring Validator interface.
In testing, I manually added a selection to the dropdown (using the browser inspector) that is not valid, since it can't be converted to an enum. I would have thought that Spring would just leave the enum attribute as null, and the validator would catch the error, but I actually get a runtime error:
javax.el.ELException: Cannot convert CC of type class java.lang.String to class com.app.enums.States
Any ideas on how to handle this?
Aucun commentaire:
Enregistrer un commentaire