title: Spring Boot : Error :Cannot call sendError() after the response has been committed
body: <p>I am getting this error .
  <strong>Cannot call sendError() after the response has been committed</strong>
  Can someone help me figure out why?.</p>
  
  <pre><code>    @Entity
      public class Product {
  
          @Id
          @GeneratedValue(strategy = GenerationType.IDENTITY)
          private int id;
  
          @OneToOne(
                  fetch = FetchType.LAZY,
                  cascade = CascadeType.ALL
          )
          @JoinColumn(name = "details_id")
          private Details details;
  //Getters and setters left out for brevity
      }
  
  
  @Entity
  public class Details {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private int id;
      private String name;
      private String description;
      private float price;
      private float discount;
      @OneToOne(mappedBy = "details")
      private Product product;
  }
  
  
  @RestController
  public class ProductController {
      @Autowired
      ProductRepository productRepository;
  
      @GetMapping("/getAllProducts")
      public Iterable&lt;Product&gt; getAllProducts(){
          return productRepository.findAll();
      }
  }
  
     @RestController
  public class DetialsController {
      @Autowired
      ProductRepository productRepository;
  
      @Autowired
      DetailsRepository detailsRepository;
  
      @PostMapping("/details")
      public Details addDetails(@RequestBody Details details) {
          Product newProduct = new Product();
          newProduct.setDetails(details);
          productRepository.save(newProduct);
          return detailsRepository.save(details);
      }
  }
  </code></pre>
  
  <p>I am able to make the POST call to /details; for adding details successfully. But when i make GET call to /getAllProducts, I am getting this error 
  <strong>Cannot call sendError() after the response has been committed</strong></p>