title: No primary or default constructor found for interface java.util.List Rest API Spring boot
body: <p>I am passing a request body to a POST request on postman similar to this:</p>
  
  <pre><code> "name":"Mars",
  "artifacts":[
     {
        "elements":[
           {
              "name":"carbon",
              "amount":0.5,
              "measurement":"g"
           }
        ],
        "typeName":"typeA"
     },
     {
        "elements":[
           {
              "name":"hydrogen",
              "amount":0.2,
              "measurement":"g"
           }
        ],
        "typeName":"typeB"
     }
  ]
  </code></pre>
  
  <p>The create method in the rest controller looks like this.</p>
  
  <pre><code>  @RequestMapping("/create")
    public Planet create(@RequestBody Planet data) {
        Planet mars = planetService.create(data.getName(),data.getArtifacts());
        return mars;
  </code></pre>
  
  <p>Planet and all its nested objects have a default constructor such as:</p>
  
  <pre><code>public Planet() {}
  </code></pre>
  
  <p>However, I am not able to create a new planet object because of lack of a default constructor. Please help!</p>
  
  <p>EDIT:
  Planet class</p>
  
  <pre><code>public class Planet {
  @JsonProperty("name")
  private String name;
  @Field("artifacts")
  private List&lt;Artifact&gt; artifacts;
  
  public Planet() {}
  
  public Planet(String name, List&lt;Artifact&gt; artifacts)
  {
  this.name = name;
  this.artifacts = artifacts;
  }
  //setters and getters
  
  }
  </code></pre>
  
  <p>Artifact class:</p>
  
  <pre><code>public class Artifact() {
  @Field("elements")
  private List&lt;Element&gt; elements;
  @JsonProperty("typeName")
  private String typeName;
  
  public Artifact() {}
  
  public Artifact(String typeName, List&lt;Element&gt; elements)
  {
  this.typeName = typeName;
  this.elements = elements;
  }
  }
  </code></pre>
  
  <p>Element class:</p>
  
  <pre><code>public class Element() {
  @JsonProperty("elementName")
  private String name;
  @JsonProperty("amount")
  private double amount;
  @JsonProperty("measurement")
  private String measurement;
  
  public Element() {}
  
  public Element(String name, double amount, String measurement)
  {
  //assignments
  }
  }
  </code></pre>