SpringTestContext returns ConfigurableWebApplicationContext
Closes gh-8233
This commit is contained in:
parent
401597c673
commit
32c3353921
|
@ -17,7 +17,6 @@
|
||||||
package org.springframework.security.config.test;
|
package org.springframework.security.config.test;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
|
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
|
||||||
import org.springframework.mock.web.MockServletConfig;
|
import org.springframework.mock.web.MockServletConfig;
|
||||||
import org.springframework.mock.web.MockServletContext;
|
import org.springframework.mock.web.MockServletContext;
|
||||||
import org.springframework.security.config.util.InMemoryXmlWebApplicationContext;
|
import org.springframework.security.config.util.InMemoryXmlWebApplicationContext;
|
||||||
|
@ -113,8 +112,10 @@ public class SpringTestContext implements Closeable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurableApplicationContext getContext() {
|
public ConfigurableWebApplicationContext getContext() {
|
||||||
if (!this.context.isRunning()) {
|
if (!this.context.isRunning()) {
|
||||||
|
this.context.setServletContext(new MockServletContext());
|
||||||
|
this.context.setServletConfig(new MockServletConfig());
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
}
|
}
|
||||||
return this.context;
|
return this.context;
|
||||||
|
|
Loading…
Reference in New Issue