Skip to content
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

spring boot 3 native build is failing #1995

Closed
ozkanpakdil opened this issue Dec 8, 2022 · 2 comments
Closed

spring boot 3 native build is failing #1995

ozkanpakdil opened this issue Dec 8, 2022 · 2 comments
Labels
invalid This doesn't seem right

Comments

@ozkanpakdil
Copy link

ozkanpakdil commented Dec 8, 2022

native image is not having swagger-ui

Code is running without problem from jvm side but when I build it mvn native:compile -Pnative native image giving 404 for swagger ui url

To Reproduce
here is the code https://github.com/ozkanpakdil/spring-examples/tree/master/swagger-boot3-graalvm

  • What version of spring-boot you are using? 3.0.0
  • What modules and versions of springdoc-openapi are you using? springdoc-openapi-starter-webmvc-ui
  • What is the actual and the expected result using OpenAPI Description (yml or json)? no yml problem
  • Provide with a sample code (HelloController) or Test that reproduces the problem http://localhost:8080/swagger-ui/index.html is giving 404 in native image

Expected behavior
see the swagger-ui

Screenshots
If applicable, add screenshots to help explain your problem.
image
suppose to look like below
image

Additional context
I tried to use springdoc-openapi-native but build is failing the error below

GraalVM Native Image: Generating 'demo' (executable)...
========================================================================================================================
[1/7] Initializing...
                                                                                    (0.0s @ 0.12GB)
Error: Could not find target method: private org.springframework.boot.Banner org.springframework.nativex.substitutions.boot.Target_SpringApplicationBannerPrinter.getImageBanner(org.springframework.core.env.Environment)
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
------------------------------------------------------------------------------------------------------------------------
                        0.8s (7.2% of total time) in 11 GCs | Peak RSS: 0.88GB | CPU load: 2.94

I think spring-native is deprecated and they merge the functionality into spring-boot so this dependency is not working now. Others also having same problem check https://stackoverflow.com/q/74712624/175554

@Chuckame
Copy link

Chuckame commented Dec 9, 2022

Same for me with webflux (springboot 3)

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Dec 9, 2022

Read the docs

https://springdoc.org/
image

For the OpenAPI REST endpoints, you just need to build your application with the spring native profile. For the UI, you will have to add springdoc.enable-native-support=true. This is mainly related to github.com/webjars/webjars-locator-core/issues/96

This has been discussed here #1284 (comment)
And available in the FAQ.

@springdoc springdoc locked as too heated and limited conversation to collaborators Dec 9, 2022
@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Dec 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants