title: Spring dependency injection with @Autowired annotation without setter
body: <p>I'm using Spring since a few months for now, and I thought dependency injection with the <code>@Autowired</code> annotation also required a setter for the field to inject.</p>
  
  <p>So, I am using it like this:</p>
  
  <pre><code>@Controller
  public class MyController {
  
      @Autowired
      MyService injectedService;
  
      public void setMyService(MyService injectedService) {
          this.injectedService = injectedService;
      }
  
      ...
  </code></pre>
  
  <p>}</p>
  
  <p>But I've tried this today:</p>
  
  <pre><code>@Controller
  public class MyController {
  
      @Autowired
      MyService injectedService;
  
      ...
  </code></pre>
  
  <p>}</p>
  
  <p>And oh surprise, no compilation errors, no errors at startup, the application is running perfectly... </p>
  
  <p>So my question is, is the setter required for dependency injection with the <code>@Autowired</code> annotation?</p>
  
  <p>I'm using Spring 3.1.1.</p>