When the filter is exposed as a bean (directly or through a registration bean), it's picked up by the auto-configuration of MockMvc. This causes a problem as MockMvc does not call init on a filter before it's used and WebSocketUpgradeFilter fails with a NullPointerException if its doFilter method is called when its init method has not been called. This commit reworks the WebSocket auto-configuration to use a ServletContextInitalizer to register WebSocketUpgradeFilter rather than a FilterRegistrationBean. This ensure that the filter is still registered at the required position in the chain (last filter before the servlet) while also preventing it from being registered with the auto-configured MockMvc in tests. Closes gh-37660 |
||
---|---|---|
.. | ||
src | ||
build.gradle |