DEV Community

cybin
cybin

Posted on

5 1

OpenApi Spring 3 NoProviderFoundException

So I started a simple Java 17 and Spring 3 new project with a couple of endpoints and first thing first, I added a Swagger, instantly I discovered that Swagger is not compatible with the new jakarta source of Spring 3.
Than I decided to use Sprindocs' OpenApi. It works by simply adding the dependencies:

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>2.0.2</version>
</dependency>

Source: https://springdoc.org/v2/#javadoc-support

The project was compiling and starting but there were still one exception:
jakarta.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

So to solve this, I had to add a jakarta validation api:

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

PS: solution found at: https://stackoverflow.com/questions/75418394/spring-boot-3-after-add-openapi-dependency-noproviderfoundexception

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (2)

Collapse
 
beamerboi profile image
Ghassen Jemaî

I had the same issue today when i tried to @enableconfiguration annotation and yes it is solved by adding the validator dependency.. what a coincidence to read about the same issue i have encountered today

Collapse
 
oussama_elalaouielisma profile image
OUSSAMA EL ALAOUI EL ISMAILI

what dependency did you add

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay