title: Jackson serializer wrapping lists by default?
body: <p>I'm using <code>spring</code> with <code>RestTemplate</code> to <code>postForEntity(req, rsp)</code> xml to a webservice.</p>
  
  <pre><code>@Bean
  public Jackson2ObjectMapperBuilderCustomizer initJackson() {
      return (builder) -&gt; builder.modules(new JaxbAnnotationModule());
  }
  </code></pre>
  
  <p>The java bean is autogenerated from <code>xsd</code> files using <code>xsdtojava</code>. Thus I cannot modify the generated class!</p>
  
  <p>Problem: The </p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  @Generated
  public class MyRequest {
      @XmlElement(required = true)
      private SubReq subs;
  
      @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType
      public static class SubReq {
          private List&lt;String&gt; list;
      }
  }
  </code></pre>
  
  <p>Result: the <code>&lt;list&gt;</code> element contains additional nested <code>&lt;list&gt;</code> elements. But why? And how can I prevent?</p>
  
  <p>Current:</p>
  
  <pre><code>&lt;MyRequest&gt;
      &lt;SubReq&gt;
          &lt;list&gt;  
              &lt;list&gt;val1&lt;/list&gt;
              &lt;list&gt;val2&lt;/list&gt;
          &lt;/list&gt;
      &lt;/SubReq&gt;
  &lt;/MyRequest&gt;
  </code></pre>
  
  <p>My goal:</p>
  
  <pre><code>&lt;MyRequest&gt;
      &lt;SubReq&gt;
          &lt;list&gt;val1&lt;/list&gt;
          &lt;list&gt;val2&lt;/list&gt;
      &lt;/SubReq&gt;
  &lt;/MyRequest&gt;
  </code></pre>
  
  <p>How can I configure jackson to not wrap the lists inside?</p>
  
  <p>The <code>MyRequest</code> element is autogenerated from:</p>
  
  <pre><code>&lt;xs:schema&gt;
      &lt;xs:element name="MyRequest"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="SubReq"&gt;
                      &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element name="list" minOccurs="0" maxOccurs="unbounded"&gt;
                                  &lt;xs:simpleType&gt;
                                      &lt;xs:restriction base="xs:string" /&gt;
                                  &lt;/xs:simpleType&gt;
                              &lt;/xs:element&gt;
                          &lt;/xs:sequence&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      ...
  &lt;/xs:schema&gt;
  </code></pre>