Skip to content

Commit f82d59a

Browse files
committed
SpringTestContext returns ConfigurableWebApplicationContext
Closes gh-8233
1 parent 45eb34c commit f82d59a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/src/test/java/org/springframework/security/config/test/SpringTestContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.security.config.test;
1818

1919
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
20-
import org.springframework.context.ConfigurableApplicationContext;
2120
import org.springframework.mock.web.MockServletConfig;
2221
import org.springframework.mock.web.MockServletContext;
2322
import org.springframework.security.config.util.InMemoryXmlWebApplicationContext;
@@ -113,8 +112,10 @@ private SpringTestContext addFilter(Filter filter) {
113112
return this;
114113
}
115114

116-
public ConfigurableApplicationContext getContext() {
115+
public ConfigurableWebApplicationContext getContext() {
117116
if (!this.context.isRunning()) {
117+
this.context.setServletContext(new MockServletContext());
118+
this.context.setServletConfig(new MockServletConfig());
118119
this.context.refresh();
119120
}
120121
return this.context;

0 commit comments

Comments
 (0)