title: Why do I get null values after injecting bean?
body: <p>When I try to inject the <code>packagePropertiesList</code> Bean in <code>Operation.class</code>, I get values from a properties file. But when I use <code>operation.removeStudentFromList()</code>, I get only null values. Do you see any problem here?</p>
  <p><a href="https://i.stack.imgur.com/SzueO.png" rel="nofollow noreferrer">values while injecting beans</a></p>
  <pre><code>@SpringBootApplication
  public class LearningCenterApplication {
  
  
      public static void main(String[] args) {
          SpringApplication.run(LearningCenterApplication.class, args);
          ApplicationContext context =
                  new AnnotationConfigApplicationContext(Config.class, Operations.class, PackageProperties.class);
          Operations operations = context.getBean(Operations.class);
          operations.removeStudentFromList();
      }
  
      @Bean
      List&lt;PackageProperties&gt; packagePropertiesList(List&lt;PackageProperties&gt; packageProperties) {
          System.out.println(packageProperties);
          return packageProperties;
      }
  
      @Bean
      @ConfigurationProperties(prefix = &quot;remove&quot;)
      public PackageProperties removeMethod() {
          return new PackageProperties();
      }
  
      @Bean
      @ConfigurationProperties(prefix = &quot;add&quot;)
      public PackageProperties addMethod() {
          return new PackageProperties();
      }
  
  }
  </code></pre>
  <pre><code>@Component
  public class Operations {
  
      private List&lt;PackageProperties&gt; packagePropertiesList;
  
  
      @Autowired
      public Operations(List&lt;PackageProperties&gt; packagePropertiesList) {
          this.packagePropertiesList = packagePropertiesList;
      }
  
      public void removeStudentFromList() {
          System.out.println(packagePropertiesList);
      }
  }
  </code></pre>
  <pre><code>public class PackageProperties {
      private String packageName;
      private String className;
      private String methodName;
  
  
  
      public String getPackageName() {
          return packageName;
      }
  
      public void setPackageName(String packageName) {
          this.packageName = packageName;
      }
  
      public String getClassName() {
          return className;
      }
  
      public void setClassName(String className) {
          this.className = className;
      }
  
      public String getMethodName() {
          return methodName;
      }
  
      public void setMethodName(String methodName) {
          this.methodName = methodName;
      }
  
      @Override
      public String toString() {
          return packageName + &quot;.&quot; + className + &quot;.&quot; + methodName;
      }
  }
  </code></pre>
  <p><em>application.properties</em></p>
  <pre><code>remove.packageName = org.epam.operations
  remove.className = Operations
  remove.methodName = removeStudentFromList()
  add.packageName = org.epam.operations
  add.className = Operations
  add.methodName = addStudent()
  </code></pre>
  <p><code>[null.null.null]</code> — output when <code>operations.removeStudentFromList()</code> is invoked</p>