title: Spring validation by @valid in service layer
body: <p>My data format is:  data[model][field]
  So, in control layer i am processing the object of my desire class and passing object to service layer. Now i want to put (@Valid Designation desg) in service layer function. But it's not working.</p>
  
  <p>Controller:</p>
  
  <pre><code>@RequestMapping(value = "/Designation/save", method = RequestMethod.POST)
  public @ResponseBody Object saveDesignation(@PathVariable String role, @ModelAttribute Designation desg, BindingResult result,
                  HttpServletRequest request, HttpServletResponse response) {
      desg.setName(request.getParameter("data[designation][name]"));
      return desgService.insert(desg, result, request, role, Designation.class);
  }
  </code></pre>
  
  <p>Service Layer:</p>
  
  <pre><code>public Object insert(@Valid Designation desg, BindingResult result,  String role, Class clazz) {
                ...............
  }
  </code></pre>
  
  <p>Servlet.xml:</p>
  
  <pre><code>&lt;mvc:annotation-driven/&gt;
  &lt;context:component-scan base-package="net.divineIt.titas.controllers" /&gt; 
  &lt;context:component-scan base-package="net.divineIt.titas.services" /&gt; 
  </code></pre>
  
  <p>Any help will be appreciated. TIA</p>