title: Why is the Spring Framework Not Logging Autowired Setter Injection?
body: <p>I'm new to Spring and I'm currently learning dependency injection. I'm using Spring Boot 2.2.2</p>
  
  <p>If I used Constructor based instruction, I see in the logs that it is being autowired.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>// Sorting an array
  @Autowired
  private SortAlgrithm sortAlgorithm;
  //^Tell Spring this is a dependency
  
  public BinarySearchImpl(SortAlgrithm sortAlgorithm) {
      super();
      this.sortAlgorithm = sortAlgorithm;
  }
  </code></pre>
  
  <p>And here are my logs where it reflects the Autowiring process handled by Spring:</p>
  
  <pre><code>2020-01-04 20:34:30.435 DEBUG 10396 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'springIn10StepsApplication'
  2020-01-04 20:34:30.441 DEBUG 10396 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'binarySearchImpl'
  2020-01-04 20:34:30.446 DEBUG 10396 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'bubbleSortAlgorithm'
  2020-01-04 20:34:30.447 DEBUG 10396 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Autowiring by type from bean name 'binarySearchImpl' via constructor to bean named 'bubbleSortAlgorithm'
  </code></pre>
  
  <p>Now, if I change the code slightly by using setter injection:</p>
  
  <pre><code>    private SortAlgorithm sortAlgorithm;
  
      // Setter injection
      @Autowired
      public void setSortAlgorithm(SortAlgorithm sortAlgorithm) {
          System.out.println("setter called");
          this.sortAlgorithm = sortAlgorithm;
      }
  </code></pre>
  
  <p>And providing the logs:</p>
  
  <pre><code>2020-01-04 20:37:23.853 DEBUG 7600 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.context.internalConfigurationPropertiesBinderFactory'
  2020-01-04 20:37:23.858 DEBUG 7600 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'springIn10StepsApplication'
  2020-01-04 20:37:23.863 DEBUG 7600 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'binarySearchImpl'
  2020-01-04 20:37:23.870 DEBUG 7600 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'bubbleSortAlgorithm'
  setter called
  </code></pre>
  
  <p>I included the 'setter called' to be printed out to let me know that the setter injection was being invoked because it wasn't being included in the logs. I was wondering if this is a fluke by Spring and if others are experiencing the same thing. I understand that my beans are being managed at the applciation context, and, at runtime, Spring is looking for the dependencies. @Autowire tells Spring what my dependencies are and injects appropriately. The first log represents that behavior. But, the fact that 'setter called' is printed out, I was wondering if it implies that Spring is performing Autowiring by invoking the setter method even if it is not reflected in the logs. </p>