Ljavax/validation/constraints/Pattern$Flag 属于哪个 Jar?

Which Jar does Ljavax/validation/constraints/Pattern$Flag belongs to?

我的类路径中有以下 Jars:

  • jre 1.8.0_251
  • hibernate-validation-6.1.5 final
  • guava-29.0-jre
  • commons-codec-1.14
import javax.validation.constraints.Pattern;
@Pattern

我收到以下 异常

错误堆栈

java.lang.NoClassDefFoundError: [Ljavax/validation/constraints/Pattern$Flag;
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.springframework.core.annotation.AttributeMethods.compute(AttributeMethods.java:256)
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source)
    at org.springframework.core.annotation.AttributeMethods.forAnnotationType(AttributeMethods.java:252)
    at org.springframework.core.annotation.AnnotationTypeMapping.<init>(AnnotationTypeMapping.java:96)
    at org.springframework.core.annotation.AnnotationTypeMappings.addIfPossible(AnnotationTypeMappings.java:116)
    at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:75)
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:68)
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46)
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:253)
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source)
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:249)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:206)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:188)
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:175)
    at org.springframework.core.annotation.TypeMappedAnnotation.of(TypeMappedAnnotation.java:636)
    at org.springframework.core.annotation.MergedAnnotation.of(MergedAnnotation.java:596)
    at org.springframework.core.type.classreading.MergedAnnotationReadingVisitor.visitEnd(MergedAnnotationReadingVisitor.java:96)
    at org.springframework.asm.ClassReader.readElementValues(ClassReader.java:2775)
    at org.springframework.asm.ClassReader.readMethod(ClassReader.java:1183)
    at org.springframework.asm.ClassReader.accept(ClassReader.java:688)
    at org.springframework.asm.ClassReader.accept(ClassReader.java:400)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidJun 23, 2020 3:38:57 PM org.apache.catalina.core.ApplicationContext

尝试使用来自的jar,貌似属于这个验证包: https://mvnrepository.com/artifact/javax.validation/validation-api/2.0.0.Final