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

Blade 已结 2 1041
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

提交回复