title: java injection - how to inject a bean with parametrized constructor
body: <p>I want to use @inject to inject a bean which has a parametrized constructor. While injecting i need to pass the parameter to the bean. To clearly explain.</p>
  
  <p>class A: </p>
  
  <pre><code>public class A{
    private String name;
    private String id;
    private int age;
  
    public A(Student student){
      name = student.getName();
      id = student.getId();
      age = student.getAge();
    }
  
    public String getName(){
       return Name;
    }
  
    ..
  
    ..
  
  }
  </code></pre>
  
  <p>Class B where bean of class A has to be injected:</p>
  
  <pre><code>public class B{
  
    @inject private Student student;
  
    //how to inject the below passing student value
    @inject private A a; // new A(student);
  
    public getNameAndAge(){
        String name = a.getName();
        int age = a.getAge();
        System.out.println(name);
    }
  
    public sendDetails(){
       sendInWebService(a);
    }
  
    ..
    ..
  </code></pre>
  
  <p>}</p>
  
  <p>In class B, the bean A has to be utilized locally in many methods. Hope this code snippets helps to understand my issue. I'm new to Spring and Java dependency injection. Our applciation don't have Spring dependency and hence @inject is the only option to do this. </p>
  
  <p>Thanks in advance.</p>