Description
Describe the bug
We're trying to migrate JHipster to use Springdoc instead of Springfox.
In a Spring WebFlux application, I have the following dependencies:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-core</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-data-rest</artifactId>
</dependency>
When the app starts, I get the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
'openApiResource' defined in class path resource
[org/springdoc/webflux/core/SpringDocWebFluxConfiguration.class]: Unsatisfied dependency expressed through
method 'openApiResource' parameter 2; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'responseBuilder'
defined in class path resource [org/springdoc/webflux/core/SpringDocWebFluxConfiguration.class]: Bean
instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springdoc.core.GenericResponseService]: Factory method 'responseBuilder' threw
exception; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletException
Another strange thing that happens with these two dependencies. A new webflux + MongoDB app fails with the following when running mvn verify
:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springdoc.core.GenericResponseService]: Factory method 'responseBuilder' threw exception; nested
exception is java.lang.NoClassDefFoundError: Could not initialize class
org.springdoc.core.GenericResponseService
However, if I change replace both dependencies with springdoc-openapi-webflux-ui
, all tests pass.
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using? 2.5.7
- What modules and versions of springdoc-openapi are you using? 1.5.13
- What is the actual and the expected result using OpenAPI Description (yml or json)?
- Provide with a sample code (HelloController) or Test that reproduces the problem
I can provide steps to reproduce, but it's kinda complicated. Here's an attempt:
git clone -b springdocs git@github.com:mshima/jhipster-bom.git
cd jhipster-bom
./mvnw install -Dgpg.skip=true
cd ..
git clone -b skip_ci-doc git@github.com:mshima/generator-jhipster.git
cd generator-jhipster
npm link
Then, create a new JHipster project (for example, in your ~/Downloads directory):
mkdir webflux-mongodb
cd webflux-mongodb
Create a .yo-rc.json
file in this directory with the following contents:
{
"generator-jhipster": {
"applicationType": "monolith",
"reactive": true,
"baseName": "sampleWebfluxMongodb",
"packageName": "tech.jhipster.sample",
"packageFolder": "tech/jhipster/sample",
"authenticationType": "jwt",
"cacheProvider": "no",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "mongodb",
"devDatabaseType": "mongodb",
"prodDatabaseType": "mongodb",
"searchEngine": false,
"buildTool": "maven",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en", "fr"],
"testFrameworks": ["gatling", "cypress"],
"serverPort": "8080",
"jhiPrefix": "jhi",
"clientPackageManager": "npm",
"clientFramework": "angularX",
"creationTimestamp": 1596513172471,
"jwtSecretKey": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
"jhipsterVersion": "7.4.0",
"skipClient": false,
"skipServer": false,
"skipUserManagement": false,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"entitySuffix": "",
"dtoSuffix": "DTO",
"blueprints": [],
"otherModules": [],
"pages": [],
"devServerPort": 4200,
"clientTheme": "none",
"clientThemeVariant": "",
"withAdminUi": true,
"serviceDiscoveryType": false,
"enableGradleEnterprise": false
}
}
Then, run jhipster
.
Once the app is finished, run ./mvnw verify
to see the test failures.
To start the app:
docker-compose -f src/main/docker/mongodb.yml up -d
./mvnw