報錯內容: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]]

SpringMvc配置時,默認將接受的時期格式化為yyyy-MM-dd HH:mm:ss。而因為使用的日期插件中就是年月日格式的。所以出現Spring轉化Date轉化失敗的問題。
這里出現一個問題,希望以后的我知道怎么回事吧?在此期間我在配置中打了斷點,但是只有在項目啟動時進入的斷點,但是在后來調用接口的時候並沒有進入斷點。這里有一個猜測。在Spring中,配置只有在項目啟動的時候初始化了一遍,而之后在調用的時候哦不進入初始化配置的方法中。
解決問題的方法:既然是映射的過程中無法將Spring轉化為Date,而又和總配置有關。並不想改總配置,於是我用HttpServletRequest直接取得參數。就不會出現問題。接受的參數直接就是Spring,需要自己轉化為Date
