Skip to content

The OAuth Authorize button missing in Swagger UI when native compiled with Spring Boot 3.0 #2255

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
magnus-larsson opened this issue Jun 4, 2023 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@magnus-larsson
Copy link

Describe the bug

  • The OAuth Authorize button missing in Swagger UI when a resource server is native compiled with Spring Boot 3.0

To Reproduce

Version used:

  • spring-boot version: v3.0.4
  • springdoc-openapi module and version: springdoc-openapi-starter-webflux-ui, v2.1.0

Steps to reproduce the behavior:

Expected behavior

  • Use the same project as above, build and run it:

    cd oauth-resource-server-webflux
    mvn clean package
    java -jar target/oauth-resource-server-webflux-3.1.7-SNAPSHOT.jar
    
  • Open the Web UI, http://127.0.0.1:8082/resource-server/swagger-ui.html, and note that the Authorize button is present:

    springdoc-oauth-java-jar-working
@giacgbj
Copy link

giacgbj commented Jun 21, 2023

Same issue using 3.1.0.

@uc4w6c
Copy link
Collaborator

uc4w6c commented Jul 16, 2023

It seems that native compile removes code that has no implementation in classes (even classes with only annotations).

OpenApiConfig has been removed.
スクリーンショット 2023-07-16 9 17 17

It was resolved by setting @OpenAPIDefinition, @SecuritySchema. in the class with @SpringBootApplication (ResourceServerApp.java for the demo repository).

@uc4w6c uc4w6c closed this as completed Jul 16, 2023
@uc4w6c uc4w6c added the question Further information is requested label Jul 16, 2023
@magnus-larsson
Copy link
Author

Hello @uc4w6c, thanks for your help and for explaining the problem!

I would prefer adding @Configuration in the OpenApiConfig - class instead of breaking the code structure to make it work when native compiled.

For details, see GraalVM Native Image Support, Source Code Generation.

Shouldn't the source code in the Spring-boot OpenAPI Demo applications be updated, e.g. the OpenApiConfig - class, before this issue is closed?
(So that the demo applications work when native compiled)

Also, maybe it is worth mentioning that adding @Configuration to @OpenAPIDefinition and @SecurityScheme is required for GraalVM native images support in the docs at https://springdoc.org?

@uc4w6c
Copy link
Collaborator

uc4w6c commented Jul 17, 2023

That's true. I will update the docs.

@uc4w6c uc4w6c reopened this Jul 17, 2023
@uc4w6c uc4w6c added documentation Improvements or additions to documentation and removed question Further information is requested labels Jul 17, 2023
@bnasslahsen
Copy link
Collaborator

@uc4w6c,

Thanks for the update. I confirm it's now published: https://springdoc.org/#is-graalvm-supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants