/** * @see AbstractApplicationContextFactory#createApplicationContext(ConfigurableApplicationContext, Object...) */ @Override protected ConfigurableApplicationContext createApplicationContext(ConfigurableApplicationContext parent, Object... resources) { ConfigurableApplicationContext context; if (allObjectsOfType(resources, Resource.class)) { context = new ResourceXmlApplicationContext(parent, resources); } else if (allObjectsOfType(resources, Class.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else if (allObjectsOfType(resources, String.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else { List<Class<?>> types = new ArrayList<>(); for (Object resource : resources) { types.add(resource.getClass()); } throw new IllegalArgumentException("No application context could be created for resource types: " + Arrays.toString(types.toArray())); } return context; }
/** * @param parent */ public ResourceXmlApplicationContext(ConfigurableApplicationContext parent, Object... resources) { helper = new ApplicationContextHelper(parent, this, resources) { @Override protected String generateId(Object... configs) { Resource[] resources = Arrays.copyOfRange(configs, 0, configs.length, Resource[].class); try { List<String> uris = new ArrayList<String>(); for (Resource resource : resources) { uris.add(resource.getURI().toString()); } return StringUtils.collectionToCommaDelimitedString(uris); } catch (IOException e) { return Arrays.toString(resources); } } @Override protected void loadConfiguration(Object... configs) { Resource[] resources = Arrays.copyOfRange(configs, 0, configs.length, Resource[].class); load(resources); } }; refresh(); }
/** * @see AbstractApplicationContextFactory#createApplicationContext(ConfigurableApplicationContext, Object...) */ @Override protected ConfigurableApplicationContext createApplicationContext(ConfigurableApplicationContext parent, Object... resources) { ConfigurableApplicationContext context; if (allObjectsOfType(resources, Resource.class)) { context = new ResourceXmlApplicationContext(parent, resources); } else if (allObjectsOfType(resources, Class.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else if (allObjectsOfType(resources, String.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else { List<Class<?>> types = new ArrayList<Class<?>>(); for (Object resource : resources) { types.add(resource.getClass()); } throw new IllegalArgumentException("No application context could be created for resource types: " + Arrays.toString(types.toArray())); } return context; }
/** * @see AbstractApplicationContextFactory#createApplicationContext(ConfigurableApplicationContext, Object...) */ @Override protected ConfigurableApplicationContext createApplicationContext(ConfigurableApplicationContext parent, Object... resources) { ConfigurableApplicationContext context; if (allObjectsOfType(resources, Resource.class)) { context = new ResourceXmlApplicationContext(parent, resources); } else if (allObjectsOfType(resources, Class.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else if (allObjectsOfType(resources, String.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else { List<Class<?>> types = new ArrayList<Class<?>>(); for (Object resource : resources) { types.add(resource.getClass()); } throw new IllegalArgumentException("No application context could be created for resource types: " + Arrays.toString(types.toArray())); } return context; }
/** * @see AbstractApplicationContextFactory#createApplicationContext(ConfigurableApplicationContext, Object...) */ @Override protected ConfigurableApplicationContext createApplicationContext(ConfigurableApplicationContext parent, Object... resources) { ConfigurableApplicationContext context; if (allObjectsOfType(resources, Resource.class)) { context = new ResourceXmlApplicationContext(parent, resources); } else if (allObjectsOfType(resources, Class.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else if (allObjectsOfType(resources, String.class)) { context = new ResourceAnnotationApplicationContext(parent, resources); } else { List<Class<?>> types = new ArrayList<Class<?>>(); for (Object resource : resources) { types.add(resource.getClass()); } throw new IllegalArgumentException("No application context could be created for resource types: " + Arrays.toString(types.toArray())); } return context; }
@Override public String toString() { return "ResourceXmlApplicationContext:" + getId(); }
@Override protected void loadConfiguration(Object... configs) { Resource[] resources = Arrays.copyOfRange(configs, 0, configs.length, Resource[].class); load(resources); } };
@Override public String toString() { return "ResourceXmlApplicationContext:" + getId(); }
@Override public String toString() { return "ResourceXmlApplicationContext:" + getId(); }
@Override public String toString() { return "ResourceXmlApplicationContext:" + getId(); }