Using the static factory for creating NON singleton beans. Even though, parameters are in 'constructor-arg' element, those are treated as normal parameters to method call.
0
test
0
Write the following code in the class which implements BeanFactoryAware , InitializingBean interfaces.
String testFileSystemNames[] = {"/","/usr","/exports"};
Object args[] = new Object[3];
ListfileSystemObjects = new ArrayList ();
for(int i=0; i< testFileSystemNames.length; i++ ){
args[0]=i+1;
args[1]=testFileSystemNames[i];
args[2]=i;
FileSystem fileSystem = (FileSystem)beanFactory.getBean("fileSystem", args);
fileSystemObjects.add(fileSystem);
}
No comments:
Post a Comment