Tag Archives: mvc

[Solved] Spring-MVC Error: org.springframework.validation.BeanPropertyBindingResult

The error report is as follows:

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object ‘shopOrder’ on field ‘orderTimePay’: rejected value [2019-01-13 12:05:00];

 

Reason & Solution:
SimpleDateFormat is non-thread-safe. It’s OK to get a new SimpleDateFormat() under each thread.

Springboot2.6.X configurate swagger error [How to Solve]

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
	at java.lang.Iterable.forEach(Iterable.java:75)

Modify YML file

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

log4j:WARN Error during default initialization [How to Solve]

Error generation environment

Generated when mybatis sets log4j log

Error description

log4j:ERROR Category option " 1 " not a decimal integer.
java.lang.NumberFormatException: For input string: " 1 "

Error reason

In the log4j.properties file, there are more spaces in the log4j.appender.console.layout.conversionpattern attribute

Solution:

Before modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{ 1 }:%L - %m%n

After modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{1}:%L - %m%n

[Solved] springmvc:Error creating bean with name ‘org.springframework.cache.interceptor.CacheInterceptor

Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0’
Speaking of this is a bit of a pitfall, spring configuration file add annotation scan **

<mvc (as long as this is checked again):annotation-driven

** /> After that, idea will automatically add a reference to you, but it adds a reference to xmlns:mvc="http://www.springframework.org/schema/cache", which causes problems. It should be changed to xmlns:mvc=”http://www.springframework.org/schema/mvc”

Spring MVC error HTTP status 400 – bad request

When the type of the requested parameter is correct and various configurations are correct, a 400 error will appear, and the console will report an error failed to convert value of type ‘Java. Lang. string’ to required type ‘Java. Lang. Integer’; Nested exception is java.lang.numberformatexception: for input string: “XXX”] a similar error may be that the request path set by your control layer and the path of static resources have the same name,
For example:
the page I visit is/user/index.html
and the requestmapping (“user”) of the control layer

when accessing/user/index.html, the user request of the servlet will be followed, and the parameter type may not be correct, which will be 400.
if the correct estimation directly returns the requested JSON result,