cybin
Posted on February 27, 2023
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
Posted on February 27, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.