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 SpringMvc is configured, the accepted period is formatted as yyyy-MM-dd HH:mm:ss by default. And because the date plug-in used is in the format of year, month, and day. Therefore, there is a problem of Spring conversion Date conversion failure.
There is a problem here, I hope I know what’s going on in the future? During this period, I set breakpoints in the configuration, but only the breakpoints entered when the project was started, but did not enter the breakpoints when calling the interface later. There is a guess here. In Spring, the configuration is initialized only when the project is started, and then it does not enter the method of initializing the configuration when it is called.
The way to solve the problem: Since it is the process of mapping, Spring cannot be converted to Date, and it is related to the overall configuration. I don’t want to change the general configuration, so I use HttpServletRequest to get the parameters directly. There will be no problems. The accepted parameter is directly Spring, which needs to be converted to Date by itself
- Error running ‘PigSellCabinetApplication’: Command line is too long. Shorten command line for PigSellCabinetApplication or also for Spring Boot default configuration
- Oracle prompt text does not match format string
- ApplicationContext.xml file header error Referenced file contains errors
- How to Solve Error: Cannot find the declaration of element ‘beans’.
- Log4j2 reports ERROR StatusLogger Unrecognized format specifier
- Browser error: Lazy require of app.binding did not set the binding field
- [Solved] Conversion not supported for type java.time.LocalDateTime
- Error reported when springboot connects to redis nested exception is redis.clients.jedis . exceptions.JedisConnectionException
- SpringBoot startup error Failed to determine a suitable driver class
- Springboot connects to the database error: testWhileIdle is true, validationQuery not set
- Error starting ApplicationContext. To display the auto-configuration report re-run your application
- [Vagrant] When vagrant up, it stops at “SSH auth method: private key” and times out.
- [How to Fix] Spring boot startup error: could not resolve placeholder
- Log jar package conflict error: Class path contains multiple SLF4J bindings
- [Solved] The version of springcloud must support the current version of springboot, otherwise the startup project will report an error: error starting ApplicationContext
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for
- Spring deployment error: Could not open ServletContext resource [/db.properties]
- [Solved] Error running ‘WebApplication‘: Command line is too long. Shorten command line for WebApplication or
- Two implementation methods of spring boot scan mapper interface class
- New Spring boot startup error Failed to auto-configure a DataSource