strust2中是如何初始化container并且使其全局单例
strust2中是如何初始化container并且使其全局单例?
?
StrutsPrepareAndExecuteFilter
?? protected PrepareOperations prepare;
??? protected ExecuteOperations execute;
?
?
Dispatcher dispatcher = init.initDispatcher(config);
??? ? init()
????? Container container = init_PreloadConfiguration();
?
?
?? private Container init_PreloadConfiguration() {
??????? Configuration config = configurationManager.getConfiguration();
??????? Container container = config.getContainer();
??????? boolean reloadi18n = Boolean.valueOf(container.getInstance(String.class, StrutsConstants.STRUTS_I18N_RELOAD));
??????? LocalizedTextUtil.setReloadBundles(reloadi18n);
??????? return container;
??? }
?
???? ? Configuration config = configurationManager.getConfiguration();
??????? Container container = config.getContainer();
?
?
?
? public synchronized Configuration getConfiguration() {
??????? if (configuration == null) {
??????????? setConfiguration(createConfiguration(defaultFrameworkBeanName));
??????????? try {
??????????????? configuration.reloadContainer(getContainerProviders());
??????????? } catch (ConfigurationException e) {
??????????????? setConfiguration(null);
??????????????? throw new ConfigurationException("Unable to load configuration.", e);
??????????? }
??????? } else {
??????????? conditionalReload(configuration.getContainer());
??????? }
??????? return configuration;
??? }
....
?
?
?
?
?prepare = new PrepareOperations(filterConfig.getServletContext(), dispatcher);
?execute = new ExecuteOperations(filterConfig.getServletContext(), dispatcher);
?
?
?
?