Hibernate 7.0.2: javax.validation.NoProviderFoundException

Viewed 211

I'm using spring-boot-starter-web:jar:2.6.2 in my project, this jar uses hibernate-validator:6.2.0.Final. Recently we decided to move to Hibernate 7.0.2.Final, so I added the following maven config:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>${rest.starter.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.hibernate.validator</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>7.0.2.Final</version>
</dependency>

But now I get the following error during integration testing or run:

javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

Why does it happen and how to fix it?

0 Answers
Related