/** * Set the config locations for this application context in init-param style, * i.e. with distinct locations separated by commas, semicolons or whitespace. * <p>If not set, the implementation may use a default as appropriate. */ public void setConfigLocation(String location) { setConfigLocations(StringUtils.tokenizeToStringArray(location, CONFIG_LOCATION_DELIMITERS)); }
/** * Set the config locations for this application context in init-param style, * i.e. with distinct locations separated by commas, semicolons or whitespace. * <p>If not set, the implementation may use a default as appropriate. */ public void setConfigLocation(String location) { setConfigLocations(StringUtils.tokenizeToStringArray(location, CONFIG_LOCATION_DELIMITERS)); }
/** * Set the config locations for this application context in init-param style, * i.e. with distinct locations separated by commas, semicolons or whitespace. * <p>If not set, the implementation may use a default as appropriate. */ public void setConfigLocation(String location) { setConfigLocations(StringUtils.tokenizeToStringArray(location, CONFIG_LOCATION_DELIMITERS)); }
public void refresh() { applicationContext.setConfigLocations(listToArray(configs)); applicationContext.refresh(); }
@Override public void initialize(AbstractRefreshableConfigApplicationContext ctx) { ctx.setAllowBeanDefinitionOverriding(false); ConfigurableEnvironment env = ctx.getEnvironment(); Set<String> aps = new LinkedHashSet<>(); Collections.addAll(aps, env.getActiveProfiles()); Collections.addAll(aps, testConfig ? Constants.PROFILES_TEST : Constants.PROFILES_PROD); env.getPropertySources().addLast(new LabelPropertySource()); env.getPropertySources().addLast(new DomainPropertySource(ctx)); env.setDefaultProfiles(Constants.PROFILE_ROOT_DEFAULT); ctx.setConfigLocations(Constants.DEFAULT_LOCATIONS); env.setActiveProfiles(aps.toArray(new String[aps.size()])); }
public ExtendsSpringBeanContainer(ExtendsSpringBeanContainer parent, List<FileObject> files, ClassLoader loader, Class<? extends AbstractRefreshableConfigApplicationContext> clazz) { if (inited == true) return; inited = true; List<String> configLocations = new ArrayList<String>(); for (FileObject fileObject : files) { String urlString = fileObject.getURL().toString(); if (!configLocations.contains(urlString)) { configLocations.add(urlString); LOGGER.logMessage(LogLevel.INFO, "添加Spring配置文件:{urlString}", urlString); } } try { applicationContext = clazz.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } applicationContext.setConfigLocations(listToArray(configLocations)); applicationContext.setParent(parent.getBeanContainerPrototype()); applicationContext.setAllowBeanDefinitionOverriding(true); applicationContext.setClassLoader(loader); applicationContext.refresh(); // initNoBeanCaseInfo(); }
this.applicationContext.setConfigLocations(checkedConfigurationResources.toArray(new String [0]));
applicationContext.setConfigLocations(checkedConfigurationResources); applicationContext.refresh();
public void initialize() { applicationContext = new DefaultComponentManagerApplicationContext(componentManager.getContainerConfiguration(), parentApplicationContext); if (componentManager != null && applicationContext instanceof ComponentManagerAware) { ((ComponentManagerAware) applicationContext).setComponentManager(componentManager); } String [] checkedConfigurationResources = ApplicationContextUtils.getCheckedLocationPatterns(applicationContext, moduleDefinition.getConfigLocations()); if (ArrayUtils.isEmpty(checkedConfigurationResources)) { log.warn("There's no valid component configuration for addon module, '{}'.", name); } applicationContext.setConfigLocations(checkedConfigurationResources); applicationContext.refresh(); for (ModuleInstance moduleInstance : getModuleInstances()) { if (componentManager != null && moduleInstance instanceof ComponentManagerAware) { ((ComponentManagerAware) moduleInstance).setComponentManager(componentManager); } if (componentManager != null && moduleInstance instanceof ApplicationContextAware) { ((ApplicationContextAware) moduleInstance).setApplicationContext(applicationContext); } moduleInstance.initialize(); } }
this.applicationContext.setConfigLocations(checkedConfigurationResources.toArray(new String [0]));