|
|
|
@ -25,7 +25,6 @@ import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import jakarta.servlet.ServletContext; |
|
|
|
import jakarta.servlet.ServletContext; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.BeanFactoryUtils; |
|
|
|
import org.springframework.beans.factory.BeanFactoryUtils; |
|
|
|
import org.springframework.beans.factory.BeanInitializationException; |
|
|
|
import org.springframework.beans.factory.BeanInitializationException; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
@ -68,6 +67,7 @@ import org.springframework.util.PathMatcher; |
|
|
|
import org.springframework.validation.Errors; |
|
|
|
import org.springframework.validation.Errors; |
|
|
|
import org.springframework.validation.MessageCodesResolver; |
|
|
|
import org.springframework.validation.MessageCodesResolver; |
|
|
|
import org.springframework.validation.Validator; |
|
|
|
import org.springframework.validation.Validator; |
|
|
|
|
|
|
|
import org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean; |
|
|
|
import org.springframework.web.HttpRequestHandler; |
|
|
|
import org.springframework.web.HttpRequestHandler; |
|
|
|
import org.springframework.web.accept.ContentNegotiationManager; |
|
|
|
import org.springframework.web.accept.ContentNegotiationManager; |
|
|
|
import org.springframework.web.bind.WebDataBinder; |
|
|
|
import org.springframework.web.bind.WebDataBinder; |
|
|
|
@ -760,15 +760,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv |
|
|
|
Validator validator = getValidator(); |
|
|
|
Validator validator = getValidator(); |
|
|
|
if (validator == null) { |
|
|
|
if (validator == null) { |
|
|
|
if (ClassUtils.isPresent("jakarta.validation.Validator", getClass().getClassLoader())) { |
|
|
|
if (ClassUtils.isPresent("jakarta.validation.Validator", getClass().getClassLoader())) { |
|
|
|
Class<?> clazz; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
String className = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean"; |
|
|
|
validator = new OptionalValidatorFactoryBean(); |
|
|
|
clazz = ClassUtils.forName(className, WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
catch (ClassNotFoundException | LinkageError ex) { |
|
|
|
catch (Throwable ex) { |
|
|
|
throw new BeanInitializationException("Failed to resolve default validator class", ex); |
|
|
|
throw new BeanInitializationException("Failed to create default validator", ex); |
|
|
|
} |
|
|
|
} |
|
|
|
validator = (Validator) BeanUtils.instantiateClass(clazz); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
validator = new NoOpValidator(); |
|
|
|
validator = new NoOpValidator(); |
|
|
|
|