-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Add support of HttpMessageConvertersAutoConfiguration for @AutoConfigureMockMvc #24000
Comments
I have similar behavior too. |
HTTP message converter auto-configuration will be included if you use |
@wilkinsona many thanks, it works! @frekele if you're interested here is custom annotation you can use: https://stackoverflow.com/questions/64648893/autoconfiguremockmvc-how-to-set-message-converters |
Would be nice to add some explanation about this into https://spring.io/guides/gs/testing-web/ which shows use of |
@rehevkor5 Could you please make that suggestion in the guide's repo: https://github.com/spring-guides/gs-testing-web/issues? |
Hello folks,
I'd like to test some rest controller. I can't use @WebMvcTest cause my security config uses JWT Token Provider which is @component itself and will be filtered out by @WebMvcTest
I can't use @SpringBootTest either, because it ignores HttpMessageConvertersAutoConfiguration and I get during test only (this means it works in prod)
org.springframework.http.converter.HttpMessageNotWritableException
Can you please add support of HttpMessageConvertersAutoConfiguration for @AutoConfigureMockMvc?
Here is sample code:
If I change @SpringBootTest and remove classes it works just fine, but initializes ALL the crap I don't need:
Thanks!
The text was updated successfully, but these errors were encountered: