views:

54

answers:

1

I am trying to write a ValidatorFactory which will give me a validator based on its type

public Validator getNewValidator(ValidatorType type){

    switch:
         case a : new Validator1();
         break;
          case b : new Validator2();
        break;

}

I want to write using spring xml beans definition

I can use method injection but it will let me create only one object and the method does

not take any arguments.

I don't want to use FactoryBean.. I am just looking whether we can do this using spring xml

bean definition.

A: 

For complex cases (more complex than the one exposed), Spring JavaConfig could be your friend.

landrain