facing 415: Unsupported Media Type error in spring rest
<p>I have created rest api to save academic master using spring rest as below</p>

<pre><code>@Secured("ROLE_ADMIN")
@RequestMapping(value = RestURIConstants.SAVE_ACADEMIC_YEAR, method = RequestMethod.POST)
public @ResponseBody AcademicYear saveAcademicYear(@RequestBody AcademicYear academicYear)
{
    logger.info("saving academic year master");
    academicYear = commonService.saveAcademicYear(academicYear);
    return academicYear;
}
</code></pre>

<p><strong>Entity AcademicYear  is as below</strong></p>

<pre><code>@Entity
@Table(name = "COM_ACADEMIC_YEAR_MST")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "yearId")

public class AcademicYear implements java.io.Serializable
{
    private static final long serialVersionUID = -8195008327271076910L;

    @Id
    @Column(name = "YEAR_ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer yearId;

    @Column(name = "YEAR_START_DT")
    @Temporal(TemporalType.TIMESTAMP)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    private Date yearStartDate;

    @Column(name = "YEAR_END_DT")
    @Temporal(TemporalType.TIMESTAMP)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    private Date yearEndDate;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "academicYear", cascade = CascadeType.ALL)
    List&lt;CourseMaster&gt; courseMaster;

    @Column(name = "YEAR_STATUS")
    Integer yearStatus;

    @Column(name = "CREATED_DT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;

    @Column(name = "CREATED_BY")
    private String createdBy;

    @Column(name = "UPDATED_DT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedDate;

    @Column(name = "UPDATED_BY")
    private String updatedBy;

    @Column(name = "RECORD_STATUS")
    private String recordStatus = "A";

    public Integer getYearId()
    {
        return yearId;
    }

    public void setYearId(Integer yearId)
    {
        this.yearId = yearId;
    }

    public Date getYearStartDate()
    {
        return yearStartDate;
    }

    public void setYearStartDate(Date yearStartDate)
    {
        this.yearStartDate = yearStartDate;
    }

    public Date getYearEndDate()
    {
        return yearEndDate;
    }

    public void setYearEndDate(Date yearEndDate)
    {
        this.yearEndDate = yearEndDate;
    }

    public Integer getYearStatus()
    {
        return yearStatus;
    }

    public void setYearStatus(Integer yearStatus)
    {
        this.yearStatus = yearStatus;
    }

    public Date getCreatedDate()
    {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate)
    {
        this.createdDate = createdDate;
    }

    public String getCreatedBy()
    {
        return createdBy;
    }

    public void setCreatedBy(String createdBy)
    {
        this.createdBy = createdBy;
    }

    public Date getUpdatedDate()
    {
        return updatedDate;
    }

    public void setUpdatedDate(Date updatedDate)
    {
        this.updatedDate = updatedDate;
    }

    public String getUpdatedBy()
    {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy)
    {
        this.updatedBy = updatedBy;
    }

    public String getRecordStatus()
    {
        return recordStatus;
    }

    public void setRecordStatus(String recordStatus)
    {
        this.recordStatus = recordStatus;
    }

    public static long getSerialversionuid()
    {
        return serialVersionUID;
    }

    @Override
    public String toString()
    {
        return "AcademicYear [yearId=" + yearId + ", yearStartDate=" + yearStartDate + ", yearEndDate=" + yearEndDate
                + ", yearStatus=" + yearStatus + ", createdDate=" + createdDate + ", createdBy=" + createdBy
                + ", updatedDate=" + updatedDate + ", updatedBy=" + updatedBy + ", recordStatus=" + recordStatus + "]";
    }

    public List&lt;CourseMaster&gt; getCourseMaster()
    {
        return courseMaster;
    }

    public void setCourseMaster(List&lt;CourseMaster&gt; courseMaster)
    {
        this.courseMaster = courseMaster;
    }

}
</code></pre>

<p>but when i try to execute the api as below</p>

<blockquote>
  <p>{"yearStartDate":"01-01-2015"} ,i am sending header as Content-Type: application/json</p>
</blockquote>

<p>i am facing the 415: Unsupported Media Type error</p>

<p>i got the root cause of the issue it is at below line</p>

<p><code>OneToMany(fetch = FetchType.LAZY, mappedBy = "academicYear", cascade = CascadeType.ALL) List&lt;CourseMaster&gt; courseMaster;</code>
if i removes this line it works.</p>