在spring web-app中,当我使用@PastOrPresent时,显示了以下错误:
(无法将PastOrPresent解析为类型)
但是org.springframework.boot:spring-boot-starter-validation条目已经是依赖项之一了。
分级文件
buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.domain'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-validation')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
}分级文件更新
...
compile('org.springframework.boot:spring-boot-starter-validation'){
exclude group: 'org.hibernate', module: 'hibernate-validator:5.3.6.Final'
}
compile 'org.hibernate:hibernate-validator:6.0.7.Final'
...
| \--- org.hibernate:hibernate-validator:5.3.6.Final -> 6.0.7.Final
| \--- org.hibernate.validator:hibernate-validator:6.0.7.Final
| +--- javax.validation:validation-api:2.0.1.Final -> 1.1.0.Final
| +--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.1.Final
| \--- com.fasterxml:classmate:1.3.1 -> 1.3.4我还有别的事要做吗?在实体内部,我仍然有相同的错误。使用新的:不推荐使用NotEmpty类型(如doc 这里所示)
https://stackoverflow.com/questions/48407999
复制相似问题