Skip to content

Commit

Permalink
SpringTestContext returns ConfigurableWebApplicationContext
Browse files Browse the repository at this point in the history
Closes gh-8233
  • Loading branch information
rwinch committed Mar 30, 2020
1 parent 946de2a commit b055f8b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.springframework.security.config.test;

import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.mock.web.MockServletConfig;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.config.util.InMemoryXmlWebApplicationContext;
Expand Down Expand Up @@ -113,8 +112,10 @@ private SpringTestContext addFilter(Filter filter) {
return this;
}

public ConfigurableApplicationContext getContext() {
public ConfigurableWebApplicationContext getContext() {
if (!this.context.isRunning()) {
this.context.setServletContext(new MockServletContext());
this.context.setServletConfig(new MockServletConfig());
this.context.refresh();
}
return this.context;
Expand Down

0 comments on commit b055f8b

Please sign in to comment.