title: Autowired vs import
body: <p>I am very new to spring boot and I am trying to grasp the concept of it. Now I came across @Autowired in it. I understood pretty much about it.</p>
  
  <p>Like, when you write @Autowired, things happen in two passes and in the second pass spring injects beans.</p>
  
  <p>Now, I have this example; </p>
  
  <pre><code>Class Abc {
  
      @Autowired
      private Xyz xyz;
  
      PSVM(String...z) {
          xyz.hello();
      } 
  }
  </code></pre>
  
  <p>Import basically imports the code into the file.</p>
  
  <p>So,</p>
  
  <pre><code>Import com.tilak.Xyz;
  
  Class Abc {
      private Xyz xyz;
  
      PSVM(String...z) {
          xyz = new Xyz();
          xyz.hello();
      }
  }
  </code></pre>
  
  <p>Why should/ shouldn't I go with the latter one? </p>
  
  <p>Is there any advantage in doing the first one? Where should I use the first one and where should I use the second one?</p>