Add overridable, protected processBeforeRefresh(:ConfigurableApplicationContext):ConfigurableApplicationContext method and call in the newApplicationContext(..) method before the ApplicationContext is refreshed.

This commit is contained in:
John Blum
2018-08-13 13:02:07 -07:00
parent 138b0b57aa
commit 68b25ebdb9

View File

@@ -54,6 +54,7 @@ public abstract class SpringApplicationContextIntegrationTestsSupport extends In
applicationContext.register(annotatedClasses);
applicationContext.registerShutdownHook();
processBeforeRefresh(applicationContext);
applicationContext.refresh();
this.applicationContext = applicationContext;
@@ -61,6 +62,10 @@ public abstract class SpringApplicationContextIntegrationTestsSupport extends In
return applicationContext;
}
protected ConfigurableApplicationContext processBeforeRefresh(ConfigurableApplicationContext applicationContext) {
return applicationContext;
}
@SuppressWarnings("unchecked")
protected <T extends ConfigurableApplicationContext> T getApplicationContext() {
return (T) this.applicationContext;