Modelmapper to convert from String to LocalDate
<p>My DTO is having date field in String format. My entity is having date as LocalDate. Currently I am skipping it from map and then later manually explicitly setting it (String to Date and vis-versa). </p>

<p>is it possible to convert it automatically? I tried Converter inside spring bean but it gives me lot of compile errors (type Converter does not take parameters, does not override convert method - also lot of error for convert() as well). </p>

<pre><code>@Bean
public ModelMapper studentModelMapper() {
....    
    Converter&lt;String, LocalDate&gt; toStringDate = new AbstractConverter&lt;String, LocalDate&gt;() {
        protected String convert(String source) {
            return source == null ? null : new LocalDate(source);
        }
    };
....
}
</code></pre>

<p>I am not very familiar with modelmapper. Any help is greatly appreciated.  </p>

<p>As suggested I tried with LocalDate for DTO but the problem is when I send this entity at front (REST call) I get following JSON.</p>

<pre><code>"dateOfBirth": {
   "year": 1972,
   "month": "JANUARY",
   "monthValue": 1,
   "dayOfMonth": 4,
   "dayOfWeek": "TUESDAY",
   "era": "CE",
   "dayOfYear": 4,
   "leapYear": true,
   "chronology": {
      "id": "ISO",
      "calendarType": "iso8601"
   }
}
</code></pre>

<p>My front end developer need "YYYY-MM-DD". </p>