You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose a TestDispatcherServlet bean in the MockMvcAutoConfiguration
This commit also contains changes to `ServletContextInitializerBeans`.
`ServletContextInitializerBeans` can now be configured to only look
for specific ServletContextInitializer subclasses, defaulting to
ServletContextIntializer.class. `SpringBootMockMvcBuilderCustomizer`
only cares about filters so it was unnecessary to look for all
`ServletContextInitializer`s. Additionally, adapting `Servlet` beans
caused a cycle once the `DispatcherServlet` bean was added and the
customizer only needs to adapt `Filter` beans.
Closesgh-13241
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcAutoConfiguration.java
+6
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,12 @@ public MockMvc mockMvc(MockMvcBuilder builder) {
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java
+20-9
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@
18
18
19
19
importjava.util.AbstractCollection;
20
20
importjava.util.ArrayList;
21
+
importjava.util.Arrays;
21
22
importjava.util.Collections;
22
23
importjava.util.Comparator;
23
24
importjava.util.EventListener;
@@ -73,10 +74,16 @@ public class ServletContextInitializerBeans
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java
+44-1
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@
20
20
importjavax.servlet.FilterChain;
21
21
importjavax.servlet.FilterConfig;
22
22
importjavax.servlet.ServletContext;
23
+
importjavax.servlet.ServletException;
23
24
importjavax.servlet.ServletRequest;
24
25
importjavax.servlet.ServletResponse;
25
26
importjavax.servlet.http.HttpServlet;
@@ -59,7 +60,17 @@ public void filterThatImplementsServletContextInitializerIsOnlyRegisteredOnce()
0 commit comments