error content: org.springframework.validation.beanpropertybindingresult: 1 errors field error in object ‘price’ on field ‘Endtime’: rejected value [2018-07-31]; codes [typeMismatch.price.endTime,typeMismatch.endTime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [price.endTime,endTime]; arguments []; default message [endTime]]; default message [Failed to convert property value of type ‘java.lang.String’ to required type ‘java.util.Date’ for property ‘endTime’; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@javax.persistence.Column java.util.Date] for value ‘2018-07-31’; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2018-07-31]]
When configuring spring MVC, the accepted period is formatted as yyyy MM DD HH: mm: ss by default. Because the date plug-in used is in the format of year, month and day. Therefore, the conversion of spring date failed
There is a problem here. I hope I know what’s going on in the future?During this period, I hit a breakpoint in the configuration, but only the breakpoint entered when the project was started, but the breakpoint did not enter when the interface was called later. Here’s a guess. In spring, the configuration is initialized only when the project is started, and then it does not enter the initialization configuration method when it is called
Solution: since spring cannot be converted to date in the mapping process, it is related to the overall configuration. I didn’t want to change the overall configuration, so I used HttpServletRequest to get the parameters directly. There will be no problem. The accepted parameter is directly spring, which needs to be converted to date
Similar Posts:
- How to Use Array.prototype.slice.call(arguments)
- This application failed to start because no Qt platform plugin could be initialized
- Failed to retrieve application JMX service URL
- After the program is compiled successfully, it will exit immediately and show thread1: breakpoint 3.1
- Laravel uses group by to report errors [How to Solve]
- This application has no explicit mapping for /error, so you are seeing this as a fallback
- Rust encountered error[E0554]: `#![feature]` may not be used on the stable release channel (switch nightly version)
- Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions
- SpringBoot Project Package Error: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin (Running Normally)
- Eclipse Unable to install breakpoint in XXX [How to Solve]