org.springframework.validation.
BindException: org.springframework.validation.Bea
第一次遇到这样的问题,请大家帮下忙
大体上就是user这个实体类中有Role和Org这两个实体类。
请大家帮帮忙,这到底是什么问题,在网上也查过相关资料,说是什么数据绑定或者是什么类型转换出错。但是我先前是没有出错的,只是后来清空数据库之后再次运行就抱着个错了.
org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 2 errors
Field error in object 'user' on field 'role': rejected value [[object Object]]; codes [typeMismatch.user.role,typeMismatch.role,typeMismatch.test.entity.user.Role,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.role,role]; arguments []; default message [role]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'test.entity.user.Role' for property 'role'; nested exception is
java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [test.entity.user.Role] for property 'role': no matching editors or conversion strategy found]
Field error in object 'user' on field 'org': rejected value [[object Object]]; codes [typeMismatch.user.org,typeMismatch.org,typeMismatch.test.entity.user.Org,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.role,role]; arguments []; default message [role]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'test.entity.user.Org' for property 'org'; nested exception is java.lang.
IllegalStateException: Cannot convert value of type [java.lang.String] to required type [test.entity.user.Org] for property 'org': no matching editors or conversion strategy found]
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.java:820)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:359)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFil