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

unable to overwrite springdoc.model-converters.polymorphic-converter.enabled in JUnit test #2921

Open
mischa-n opened this issue Feb 26, 2025 · 0 comments

Comments

@mischa-n
Copy link

Describe the bug

If you have multiple @SpringBootTests that start a web environment, the property springdoc.model-converters.polymorphic-converter.enabled is evaluated when starting the first test and the result / the io.swagger.v3.core.converter.ModelConverters to be used are apparently cached somewhere outside the Spring application context.

If you then try to set the property to a different value in subsequent unit tests (e.g. via org.springframework.boot.test.context.SpringBootTest.properties()), this has no effect.

(@DirtiesContext and other approaches also do not work as a workaround).

To Reproduce
Steps to reproduce the behavior:

  • JUnit 5.11.3
  • Spring Boot 3.3.9
  • springdoc 2.6.0
  • Swagger 2.2.27
  • Apache Maven 3.9.9
  • Java 21.0.3

Expected behavior

The property springdoc.model-converters.polymorphic-converter.enabled may be overwritten in any test.

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

No branches or pull requests

1 participant