title: How Dependency Injection Manually Implemented?
body: <p>How we can manually inject an object without using the facility of containers. I did something similar through reflection as follows.</p>
  
  <pre><code>Class actionClass = Class.forName("SampleClass");
  Object actionObject = actionClass.newInstance();
  Method reqMethod = actionClass.getMethod("setRequest", HttpServletRequest.class);
  reqMethod.invoke(actionObject,request);
  </code></pre>
  
  <p>is it the right way to do DI?</p>
  
  <p>My intention is to pass request object to different controller classes dynamically from a dispatcher filter,where we get request and response objects.
  I am fearing about the performace of reflection.Is there any replacement for doing DI?</p>