Skip to content

Springdoc-openapi-webmvc-core not enought for Springdoc-openapi-native #1442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JulienHoullier opened this issue Jan 12, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@JulienHoullier
Copy link

JulienHoullier commented Jan 12, 2022

Describe the bug
When only using the Springdoc-openapi-webmvc-core and adding Springdoc-openapi-native, the application fails to start since SpringDocHints expect a bean SwaggerUiConfigProperties why is i guess provided by auto-configuration in springdoc-openapi-ui

To Reproduce
Steps to reproduce the behavior:

  • Create a Spring Boot Native APP (Spring boot 2.6.2 + Spring Native 0.11.1) using Spring Initialzer
  • Add module springdoc-openapi-webmvc-core and springdoc-openapi-native 1.6.3
  • Activate springdoc.api-docs.enabled=true
  • Error printed

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springdoc.nativex.core.SpringDocHints': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springdoc.core.SwaggerUiConfigProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Expected behavior

  • No error

Workaround

  • Add the expected bean in your application:
    @Bean public SwaggerUiConfigProperties swaggerUiConfigProperties() { return new SwaggerUiConfigProperties(); }
@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Jan 12, 2022

@JulienHoullier,

  1. First make sure you use the last stable version before opening issues.
  2. Second, webmvc demo is just deployed using spring-native.

So make sure you review your configuration.
And if you still believe, you faced an issue, then make sure you provide Provide a Minimal, Reproducible Example - with HelloController that reproducesthe problem.

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Jan 12, 2022
@JulienHoullier
Copy link
Author

Okay, i'll try to provide you an example project, but the problem is obvious for me,
even in the 1.6.4 the problematic code is present
https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-native/src/main/java/org/springdoc/nativex/core/SpringDocHints.java#L305

The demo webmvc you are referencing is using the ui dependency:

<dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> </dependency>

What i use is only le webmvc-core
<dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-webmvc-core</artifactId> </dependency>

Regards

@JulienHoullier
Copy link
Author

JulienHoullier commented Jan 13, 2022

Here your example project, a small spring initializr with springdoc-openapi-native and springdoc-openapi-webmvccore
So you can re-open the issue

test.zip

@bnasslahsen bnasslahsen added bug Something isn't working and removed invalid This doesn't seem right labels Jan 13, 2022
bnasslahsen added a commit that referenced this issue Jan 13, 2022
mpleine pushed a commit to mpleine/springdoc-openapi that referenced this issue May 17, 2025
mpleine pushed a commit to mpleine/springdoc-openapi that referenced this issue May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants