/** * Load bean definitions from the given Groovy scripts or XML files. * <p>Note that ".xml" files will be parsed as XML content; all other kinds * of resources will be parsed as Groovy scripts. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public void load(Class<?> relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); } load(resources); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param resourceLocations the resources to load from */ public GenericGroovyApplicationContext(String... resourceLocations) { load(resourceLocations); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resources and automatically refreshing the context. * @param resources the resources to load from */ public GenericGroovyApplicationContext(Resource... resources) { load(resources); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public GenericGroovyApplicationContext(Class<?> relativeClass, String... resourceNames) { load(relativeClass, resourceNames); refresh(); }
/** * Load bean definitions from the given Groovy scripts or XML files. * <p>Note that ".xml" files will be parsed as XML content; all other kinds * of resources will be parsed as Groovy scripts. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public void load(Class<?> relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); } load(resources); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public GenericGroovyApplicationContext(Class<?> relativeClass, String... resourceNames) { load(relativeClass, resourceNames); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resources and automatically refreshing the context. * @param resources the resources to load from */ public GenericGroovyApplicationContext(Resource... resources) { load(resources); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param resourceLocations the resources to load from */ public GenericGroovyApplicationContext(String... resourceLocations) { load(resourceLocations); refresh(); }
@Test public void testLoadingMultipleConfigFilesWithRelativeClass() { GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(); ctx.load(GroovyApplicationContextTests.class, "applicationContext2.groovy", "applicationContext.groovy"); ctx.refresh(); Object framework = ctx.getBean("framework"); assertNotNull("could not find framework bean", framework); assertEquals("Grails", framework); Object company = ctx.getBean("company"); assertNotNull("could not find company bean", company); assertEquals("SpringSource", company); }
/** * Load bean definitions from the given Groovy scripts or XML files. * <p>Note that ".xml" files will be parsed as XML content; all other kinds * of resources will be parsed as Groovy scripts. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public void load(Class<?> relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); } load(resources); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public GenericGroovyApplicationContext(Class<?> relativeClass, String... resourceNames) { load(relativeClass, resourceNames); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resources and automatically refreshing the context. * @param resources the resources to load from */ public GenericGroovyApplicationContext(Resource... resources) { load(resources); refresh(); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param resourceLocations the resources to load from */ public GenericGroovyApplicationContext(String... resourceLocations) { load(resourceLocations); refresh(); }