1

I am playing with some Spring Boot code to convert a java class to a Json schema and am getting strange behavior just by addin the dependency to the POM file as in

    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-jsonSchema</artifactId>
        <version>2.9.4</version>
    </dependency>

the error I am getting is:

The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath

Any suggestion on reading on this or resolving.

Thanks.

Basixp
  • 115
  • 6

1 Answers1

2

Yes this comes because the artifact mentioned by you depends on:

<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.1.0.Final</version>
</dependency>

But this is only the validation API, a real validator that can do the 'real' work has to be added. It would be interesting to see your pom.xml because many Spring Boot Starters already come with a validation implementation, e.g.:

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

…comes with…

<dependency>
    <groupId>org.hibernate.validator</groupId>
    <artifactId>hibernate-validator-parent</artifactId>
</dependency>

By the way, the behavior described by you is also documented in this Spring Boot issue.

It will be fixed with this pull request which mandates a validation implementation only if a validation action is really performed (@Validated).

mle
  • 2,466
  • 1
  • 19
  • 25