Попытка настроить Spring-MVC для использованиядля @ControllerAdvice для GlobalExceptionHandeling в dispatcher-servlet.xml - PullRequest
0 голосов
/ 03 июля 2019

Мне нужно использовать @ControllerAdvice для глобальной обработки исключений в моем приложение. Для этого я сделал эти изменения в моем диспетчере Исключение при настройке xmlns: mvc в диспетчере. (

Я пробовал конфигурацию с версией и без, но в обоих случаи это не работает. Между тем я не сделал ни одного кода относительно @ ControllerAdvice.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-4.3.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
        ">
    <mvc:annotation-driven/> 
    <context:annotation-config/>
.....

ОШИБКА msg Я получаю:

2019-07-03 17:41:13 WARN  XmlWebApplicationContext  - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
2019-07-03 17:41:13 ERROR DispatcherServlet  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
...