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
Top comments (2)
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
what dependency did you add