Spring Boot - Validations stopped working after upgrade from 2.2.5 to 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.

So, I added it to my pom.xml:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

My pom parent is:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.0.RELEASE</version>
    <relativePath></relativePath>
</parent>

My Controller looks like this:

@PostMapping( value = "/signup", consumes = MediaType.APPLICATION_JSON_VALUE )
@ResponseStatus( value = HttpStatus.OK )
public void signUp( @Valid @RequestBody ClientDto clientDto )
{
    onboardingService.signUp( clientDto );
}

EDIT:

I WAS ABLE TO FOUND THE ISSUE, CHECK MY ANSWER BELOW!

Thanks everybody for the help!


Solution 1:

Validation starter not included in web starters anymore.

The spring-boot-starter-validation is not a transitive dependency of spring-boot-starter-web and spring-boot-starter-webflux anymore.

Add this dependency for validations work.

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

Solution 2:

According to spring boot 2.3.1 release there is no longer contains spring-boot-starter-validation with spring starter

how to add starter validation on

maven

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

Gradle

dependencies {
  ...
  implementation 'org.springframework.boot:spring-boot-starter-validation'
}

referee the release note

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#validation-starter-no-longer-included-in-web-starters