title: Unable to inject array list as dependency
body: <p>I am creating a bean with annotations. </p>
  
  <pre><code>@Component
  public class MyClass
  {
  
      @Autowired
      private ArrayList&lt;String&gt; myFriends= new ArrayList&lt;String&gt;();
  
     //Getters and setters  
  
  }
  </code></pre>
  
  <p>I am getting the following exception</p>
  
  <p><strong>Could not autowire field: private java.util.ArrayList com.mypackage.MyClass.myFriends; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.util.ArrayList] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}</strong></p>
  
  <p>I also tried with this</p>
  
  <pre><code>@Resource
      private ArrayList&lt;String&gt; myFriends= new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>I am getting the following exception</p>
  
  <p><strong>No matching bean of type [java.util.ArrayList] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}</strong></p>
  
  <p>Please let me know how to fix this.</p>