Spring Boot-从2.2.5升级到2.3.0后,验证停止工作 [英] Spring Boot - Validations stopped working after upgrade from 2.2.5 to 2.3.0
问题描述
我已经将Spring Boot项目从2.2.5迁移到2.3.0,此后,验证停止工作(根本没有调用它们).
I've migrated a Spring Boot project from 2.2.5 to 2.3.0 and after that, Validations stopped to work (they aren't invoked at all).
I read in changelog documentation (https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3.0-M1-Release-Notes), that spring-boot-starter-validation
now needs to be added manually as a dependency.
因此,我将其添加到了pom.xml:
So, I added it to my pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
我的pom父母是:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<relativePath></relativePath>
</parent>
我的控制器如下:
@PostMapping( value = "/signup", consumes = MediaType.APPLICATION_JSON_VALUE )
@ResponseStatus( value = HttpStatus.OK )
public void signUp( @Valid @RequestBody ClientDto clientDto )
{
onboardingService.signUp( clientDto );
}
我能够找到该问题,请检查下面的答案!
I WAS ABLE TO FOUND THE ISSUE, CHECK MY ANSWER BELOW!
感谢大家的帮助!
推荐答案
根据spring boot 2.3.1版本 不再包含带有Spring Starter的spring-boot-starter-validation
According to spring boot 2.3.1 release there is no longer contains spring-boot-starter-validation with spring starter
如何在
专家
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
成绩
dependencies {
...
implementation 'org.springframework.boot:spring-boot-starter-validation'
}
裁判发布说明
这篇关于Spring Boot-从2.2.5升级到2.3.0后,验证停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!