BladeX2.8.2升级 BladeX2.9.1后 之前没问题的方法报错了!!!

Blade 已结 2 1035
1664087911
1664087911 剑圣 2022-04-07 21:08

一、该问题的重现步骤是什么?

  1.  BimsBaseService是参照BaseService的写的方法 由于业务代码实体类中有新的公用的参数,所以参照BaseService BaseEntity写了一套

  2. image.png

2022-04-07 20:26:34.224 ERROR 1 --- [  XNIO-1 task-2] o.s.c.l.e.BladeRestExceptionTranslator   : 服务器异常


javax.validation.ConstraintDeclarationException: HV000152: Two methods defined in parallel types must not declare parameter constraints, if they are overridden by the same method, but methods BaseService#changeStatus(List, Integer) and BimsBaseService#changeStatus(List, Integer) both define parameter constraints.

at org.hibernate.validator.internal.metadata.aggregated.rule.ParallelMethodsMustNotDefineParameterConstraints.apply(ParallelMethodsMustNotDefineParameterConstraints.java:23)

at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.assertCorrectnessOfConfiguration(ExecutableMetaData.java:462)

at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.build(ExecutableMetaData.java:380)

at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataBuilder$BuilderDelegate.build(BeanMetaDataBuilder.java:260)

at org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataBuilder.build(BeanMetaDataBuilder.java:133)

at org.hibernate.validator.internal.metadata.BeanMetaDataManagerImpl.createBeanMetaData(BeanMetaDataManagerImpl.java:206)

at org.hibernate.validator.internal.metadata.BeanMetaDataManagerImpl.getBeanMetaData(BeanMetaDataManagerImpl.java:165)

at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:267)

at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:235)

at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:104)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)

2. 

3.


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。

2条回答
  •  yinyuncan
    yinyuncan (最佳回答者)
    2022-04-08 08:40

    试试配置这个:

    @Configuration
    public class ValidatorConfig
    {
       @Bean
       public LocalValidatorFactoryBean validatorAllowingParallelMethodParameterConstraints()
       {
          LocalValidatorFactoryBean defaultValidator = ValidationAutoConfiguration.defaultValidator(SpringUtil.getContext());
    
          Properties properties = new Properties();
          properties.put( HibernateValidatorConfiguration.ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS, "true" );
          defaultValidator.setValidationProperties( properties );
    
          return defaultValidator;
       }
    }

    来源:https://github.com/spring-projects/spring-framework/issues/26149

    1 讨论(5)
  • 2022-04-07 21:25

    如果没有代码和重现步骤的话,除了百度谷歌,是很难帮你找原因的。只能帮你把报错原因翻译发给你

    Two methods defined in parallel types must not declare parameter constraints, if they are overridden by the same method, but methods BaseService#changeStatus(List, Integer) and BimsBaseService#changeStatus(List, Integer) both define parameter constraints.
    如果并行类型中定义的两个方法被同一个方法覆盖,则它们不能声明参数约束,但方法BaseService#changeStatus(List,Integer)和BimsBaseService#changeStatus(List,Integer)都定义了参数约束。


    0 讨论(0)
提交回复