title: conditional beans using spring
body: <p>I am trying to write a <code>ValidatorFactory</code> which will give me a validator based on its type </p>
  
  <pre><code>public Validator getNewValidator(ValidatorType type){
  
      switch:
           case a : new Validator1();
           break;
            case b : new Validator2();
          break;
  
  }
  </code></pre>
  
  <p>I want to write using spring xml beans definition</p>
  
  <p>I can use method injection but it will let me create only one object and the method does </p>
  
  <p>not take any arguments.</p>
  
  <p>I don't want to use <code>FactoryBean</code>.. I am just looking whether we can do this using spring xml </p>
  
  <p>bean definition.</p>