title: Using autowired beans in an object created at runtime
body: <p>I have a class B which implements W interface. It has a default implementation of W's method. class C and D override  default implementation for which they need a service whose bean is instantiated by spring. String a and b comes from user and hence there is no way I can create a bean of B/C/D in advance. So I have a factory which creates a new object based on user parameters (it will create B/C/D based on parameters). Is there any clean way I can use service beans(aa/bb/cc/dd etc.) from inside C and D (spring autowires during server startup, at that time parameter required for instantiating B/C/D are not available) or is there any better way to solve the problem ?</p>
  
  <pre><code> Class B implements W{
        String a;
        String b;
        B (String a, String b);
  
        w_method(){
  
        }
     }
  
      Class C extends B {
        @Autowired
        Service aa;
  
        @Autowired
        Service bb;
  
        @Autowired
        Service cc;
  
        @override
        w_method(){
        }
      }
  
  Class D extends B {
    @Autowired
    Service dd;
  
    @override
    w_method(){
    }
  }
  </code></pre>