title: how to solve Unsupported Media Type 415 using spring boot and angular4?
body: <p>I am using angular 4 and spring Boot,while i execute the project in command line getting error(Unsupported Media Type 415)..</p>
  
  <p><strong>ang.service.ts:</strong></p>
  
  <pre><code>import {Injectable} from '@angular/core';
  import {Http,RequestOptions} from '@angular/http';
  import {Observable} from 'rxjs';
  @Injectable()
  export class shopService {
    handleError: any;
    headers: any;
    private shopUrl = '/api/createRecord';
    private header = new Headers({'Content-Type': 'application/json'}); 
  
    constructor(private http: Http) {}
  
    createShop(shopcreate: any): Promise&lt;any&gt; {       
     this.headers});      
      return this.http
       .post(this.shopUrl,JSON.stringify(shopcreate), {headers: this.headers})
       .toPromise()
       .then(res =&gt; res.json() as any)
      .catch(this.handleError);
    }
  }
  </code></pre>
  
  <p><strong>springboot Controller</strong></p>
  
  <pre><code>@RequestMapping(value = "/api/createRecord",method = RequestMethod.POST)
      public @ResponseBody String shop(@RequestBody Shop shops) {
          String shopname = request.getParameter("shopname");
          System.out.println("Welcome to new Create Record Shop Name: " + shopname);
          return "";      
      }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code> ERROR Error: Uncaught (in promise): Response with status: 415 Unsupported Media Type for URL: http://localhost:4200/api/createRecord
  at resolvePromise (zone.js:710) [angular]
      at resolvePromise (zone.js:681) [angular]
      at polyfills.bundle.js:3364:17 [angular]
      at Object.onInvokeTask (core.es5.js:3881) [angular]
      at drainMicroTaskQueue (zone.js:591) [&lt;root&gt;]
      at XMLHttpRequest.ZoneTask.invoke (zone.js:464) [&lt;root&gt;]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YZK8O.png" rel="nofollow noreferrer">Error image  in browser consel</a></p>