Application application = (Application) systemEvent.getSource();
FacesContext initFacesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = initFacesContext.getExternalContext();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
String appConfigAttrName = ApplicationConfig.class.getName();
ApplicationConfig applicationConfig = (ApplicationConfig) applicationMap.get(appConfigAttrName);
if (applicationConfig == null) {
boolean resolveEntities = WebConfigParam.ResolveXMLEntities.getBooleanValue(externalContext);
String requestServletPath = externalContext.getRequestServletPath();
ApplicationConfigInitializer applicationConfigInitializer = new ApplicationConfigInitializerImpl(
requestServletPath, resolveEntities);
try {
applicationConfig = applicationConfigInitializer.initialize();
applicationMap.put(appConfigAttrName, applicationConfig);
// Register the configured factories with the factory extension finder.
FacesConfig facesConfig = applicationConfig.getFacesConfig();
List<ConfiguredElement> configuredFactoryExtensions = facesConfig.getConfiguredFactoryExtensions();
if (configuredFactoryExtensions != null) {
FactoryExtensionFinder factoryExtensionFinder = FactoryExtensionFinder.getInstance();