title: Difference between @Bean and @Autowired
body: <p>Why can't I use <code>@Autowired</code> in this case?</p>
  
  <pre><code>@SpringBootApplication
  public class Application {
  
      @Autowired
      BookingService bookingService;
  
      public static void main(String[] args) {
          bookingService.book("Alice", "Bob", "Carol");
      }
  }
  </code></pre>
  
  <p>but can use <code>@Bean</code> </p>
  
  <pre><code>@SpringBootApplication
  public class Application {
  
      @Bean
      BookingService bookingService() {
          return new BookingService();
      }
  
      public static void main(String[] args) {
          ApplicationContext ctx = SpringApplication.run(Application.class, args);
          BookingService bookingService = ctx.getBean(BookingService.class);
          bookingService.book("Alice", "Bob", "Carol");
      }
  }
  </code></pre>
  
  <p>Aren't the two ways to generate <code>BookingService</code> the same thing?</p>