Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce createContext() factory method in AbstractGenericContextLoader #25600

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -112,7 +112,7 @@ public final ConfigurableApplicationContext loadContext(MergedContextConfigurati

validateMergedContextConfiguration(mergedConfig);

GenericApplicationContext context = new GenericApplicationContext();
GenericApplicationContext context = createContext();

ApplicationContext parent = mergedConfig.getParentApplicationContext();
if (parent != null) {
Expand All @@ -130,6 +130,15 @@ public final ConfigurableApplicationContext loadContext(MergedContextConfigurati
return context;
}

/**
* Creates instance of application context used by this {@code ContextLoader}
*
* @return new Instance of application context
*/
protected GenericApplicationContext createContext() {
return new GenericApplicationContext();
}

/**
* Validate the supplied {@link MergedContextConfiguration} with respect to
* what this context loader supports.
Expand Down Expand Up @@ -184,7 +193,7 @@ public final ConfigurableApplicationContext loadContext(String... locations) thr
logger.debug(String.format("Loading ApplicationContext for locations [%s].",
StringUtils.arrayToCommaDelimitedString(locations)));
}
GenericApplicationContext context = new GenericApplicationContext();
GenericApplicationContext context = createContext();
prepareContext(context);
customizeBeanFactory(context.getDefaultListableBeanFactory());
createBeanDefinitionReader(context).loadBeanDefinitions(locations);
Expand Down