Given the following MyConstructorClass:
@Component
public class MyConstructorClass{
  MyObj var;
  public MyConstructorClass( MyObj constrArg ){
    this.var = var;
  }
...
}
How can I autowire a field that requires a constructor argument from a previously @Autowired field? Below is an example.
Note - this question, I believe, is similar to this one, except that my constructor argument is not a String. This code sample is slightly modified from this question.
@Service
public class MyBeanService{
  @Autowired               
  CustomObject customObj;                // no arguments to constructor
  @Autowired
  MyConstructorClass myConstructorClass; // requires `customObj` as an argument
  ....
}
How can I modify MyBeanService to properly construct myConstructorClass with customObj?
 
     
     
     
     
    