title: Spring data rest and business rules validation
body: <p>I want to seek a best practice for applying business rules when working with spring data rest.</p>
  
  <p>Lets consider following scenario:</p>
  
  <ul>
  <li>I have a <code>Customer</code> and <code>Order</code> in <code>@OneToMany</code> relationship.</li>
  <li>I have a business rule saying that <code>Customer</code> needs to have <em>verified</em> flag set to be able to make orders</li>
  </ul>
  
  <p>So I need to make sure that whenever someone <code>POST</code>s to <code>/orders</code> the <code>Customer</code> making the call is <em>verified</em>.</p>
  
  <p>I'm considering using <em>beforeSave</em> <a href="https://docs.spring.io/spring-data/rest/docs/2.1.0.RELEASE/reference/html/validation-chapter.html" rel="noreferrer">Validators</a> autowiring other service/repositories into the <code>Validator</code> and check whatever needs to be checked.</p>
  
  <p>Is there better way of achieving the same?</p>