一、该问题的重现步骤是什么?
BimsBaseService是参照BaseService的写的方法 由于业务代码实体类中有新的公用的参数,所以参照BaseService BaseEntity写了一套
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.
二、你期待的结果是什么?实际看到的又是什么?
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
试试配置这个:
@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
如果没有代码和重现步骤的话,除了百度谷歌,是很难帮你找原因的。只能帮你把报错原因翻译发给你
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)都定义了参数约束。
扫一扫访问 Blade技术社区 移动端