Skip to content

Springdoc v2 with Spring 6 (without Spring Boot) #83

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
ML-Marco opened this issue Sep 17, 2024 · 5 comments
Closed

Springdoc v2 with Spring 6 (without Spring Boot) #83

ML-Marco opened this issue Sep 17, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@ML-Marco
Copy link

ML-Marco commented Sep 17, 2024

While the documentation for v1 had a FAQ entry on how to use the library in a project without Spring Boot, this entry no longer exists in the v2 documentation.

Does this mean the project is no longer useable in applications that only make use of the Spring Framework 6 without Spring Boot 3?

I think it'd be helpful for others if the answer to this question could be added to the documentation, in case it's not already there and I missed it.

@bnasslahsen
Copy link
Contributor

@ML-Marco,

Currently, there has been no such a request to use Spring 6.
But technically, there no reason why it shouldn't work.

If you have any Minimal, Reproducible Example - with HelloController that needs to use springdoc v2, feel free to share.

@bnasslahsen bnasslahsen added the question Further information is requested label Sep 23, 2024
@ML-Marco
Copy link
Author

ML-Marco commented Sep 24, 2024

@bnasslahsen
I have created a minimal project with Spring 6, Jetty 11 and a TestController here: https://github.com/ML-Marco/springdoc-with-spring-6

Maybe you can add this to the list of examples. I'm sure this can be helpful for others too.

Two more questions: It seems to be required to specify springdoc.swagger-ui.version. Otherwise the SwaggerResourceResolver will look in the wrong place. Can this be optimized to default to the version that you specify in the parent pom for the webjar?

Do you have a feeling for how complicated it would be to refactor the project so that Spring Boot is an optional dependency and not a required one? There is no real alternative when it comes to Swagger and Spring and I think that there are more projects out there that only use Spring Framework 6 (without Spring Boot). Adding the Spring Boot dependency just for this library adds quite a lot of classes.

@bnasslahsen bnasslahsen reopened this Sep 24, 2024
@bnasslahsen
Copy link
Contributor

@ML-Marco,

I have attached a sample working sample, where you do not have to reference the springdoc.swagger-ui.version.
springdoc-with-spring-6.zip

swagger-ui: http://localhost:1337/swagger-ui.html
api-docs url: http://localhost:1337/v3/api-docs

Let me know if it works for you.
Once it's validated, we can update the documentation accordingly.

@bnasslahsen bnasslahsen added the documentation Improvements or additions to documentation label Sep 24, 2024
@ML-Marco
Copy link
Author

@bnasslahsen

Thanks for that. It's working and what I was missing was the registration of SpringDocUIConfiguration which sets the correct Swagger UI version.

I updated my repository.

@bnasslahsen
Copy link
Contributor

@ML-Marco,

Thank you for your feedback.
We will then update the FAQ very sonne with the guidance as well.

@bnasslahsen bnasslahsen transferred this issue from springdoc/springdoc-openapi Sep 27, 2024
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 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants