Use consistent current thread context classloader for initialization
Ensure `Thread.currentThread().getContextClassLoader()` returns the same
classloader for all types of initialization.
Prior to this commit, `JettyEmbeddedWebAppContext` would return a
different classloader when initializing Servlet and Filter classes. This
was due to the fact that our `deferredInitialize()` method has called
outside of a `getContext().call(...)`.
Fixes gh-37649
Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
@ -1382,6 +1384,26 @@ public abstract class AbstractServletWebServerFactoryTests {
@@ -1382,6 +1384,26 @@ public abstract class AbstractServletWebServerFactoryTests {
+" \\(http(/1.1)?\\), [0-9]+ \\(http(/1.1)?\\)( with context path '(/)?')?");
@ -1455,7 +1477,7 @@ public abstract class AbstractServletWebServerFactoryTests {
@@ -1455,7 +1477,7 @@ public abstract class AbstractServletWebServerFactoryTests {
@ -1833,4 +1855,43 @@ public abstract class AbstractServletWebServerFactoryTests {
@@ -1833,4 +1855,43 @@ public abstract class AbstractServletWebServerFactoryTests {