-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
NPE from Jetty's WebSocketUpgradeFilter when testing with @SpringBootTest, @AutoConfigureMockMvc, and MockMvc #37660
Comments
Thanks for the sample. The change in behavior is due to the fix for #37115. The NPE also occurs with Spring Boot 3.1.3 if you define a filter registration bean for Jetty's @SpringBootApplication(exclude = WebSocketServletAutoConfiguration.class)
public class DemoApplication { The root cause of the problem is that MockMvc is calling |
thanks @wilkinsona, I will add the workaround suggested for now, but is there a plan for a proper fix? |
in order to prevent tests to fail because of @MockMvc calling an uninitialized `WebSocketUpgradeFilter`, websocket servlet autoconfiguration needs to be excluded from the app autoconfiguration, but presumably only until spring-boot 3.2.0-M4 arrives. cf. spring-projects/spring-boot#37660 (comment)
in order to prevent tests to fail because of @MockMvc calling an uninitialized `WebSocketUpgradeFilter`, websocket servlet autoconfiguration needs to be excluded from the app autoconfiguration, but presumably only until spring-boot 3.2.0-M4 arrives. cf. spring-projects/spring-boot#37660 (comment)
I have created a sample repo, with a project that is simply a demo created with spring initializr
https://github.com/fripoli/spring-boot-demo-bug-report
added starter web, jetty, actuator and excluded tomcat
the error happens on spring 3.1.4 but not on 3.1.3
the error on the HealthControllerTest is
The text was updated successfully, but these errors were encountered: