jump to navigation

The lighter side of programming October 27, 2007

Posted by The Saint in Technology.
Tags: ,
add a comment

Loved this post, especially the comments section about Perl.

http://davidrupp.blogspot.com/2007/10/last-language-war-language-trolling.html

Spring: factory-bean or what September 26, 2007

Posted by The Saint in Gyaan Korner, Technology.
Tags: ,
add a comment

There are two ways to defined factory beans in Spring.

1. Where you have a factory class or manager, which has static methods to return instances of various classes. For eg:
public class MyFactory {
public static ClassA getClassAInstance(){
….
return new ClassB();
}

public static ClassB getClassBInstance(){
….
return new ClassB();
}

}

the xml configuration would be:

2. The second approach is when you have a class which has non-static methods to return instances.
public class MyFactory {
public ClassA getClassAInstance(){
….
return new ClassB();
}

public ClassB getClassBInstance(){
….
return new ClassB();
}

}

In this case the xml configuration would slightly change to have another bean, which is then accessed in the other bean definitions.

HTH