title: Who implemente the spring BindingResult?
body: <p>I'm new to Spring MVC and I'm trying to understand the following code</p>
  
  <pre><code>package com.companyname.springapp.web;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.validation.BindingResult;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.validation.Valid;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import com.companyname.springapp.service.PriceIncrease;
  import com.companyname.springapp.service.ProductManager;
  
  @Controller
  @RequestMapping(value="/priceincrease.htm")
  public class PriceIncreaseFormController {
  
      /** Logger for this class and subclasses */
      protected final Log logger = LogFactory.getLog(getClass());
  
      @Autowired
      private ProductManager productManager;
  
      @RequestMapping(method = RequestMethod.POST)
      public String onSubmit(@Valid PriceIncrease priceIncrease, BindingResult result)
      {
          if (result.hasErrors()) {
              return "priceincrease";
          }
  
          int increase = priceIncrease.getPercentage();
          logger.info("Increasing prices by " + increase + "%.");
  
          productManager.increasePrice(increase);
  
          return "redirect:/hello.htm";
      }
  
      @RequestMapping(method = RequestMethod.GET)
      protected PriceIncrease formBackingObject(HttpServletRequest request) throws ServletException {
          PriceIncrease priceIncrease = new PriceIncrease();
          priceIncrease.setPercentage(15);
          return priceIncrease;
      }
  
      public void setProductManager(ProductManager productManager) {
          this.productManager = productManager;
      }
  
      public ProductManager getProductManager() {
          return productManager;
      }
  
  }
  </code></pre>
  
  <p>As far as I know the BindingResult is an interface and the onSubmit method receives a BindingResult object. What I don't understand is: Who implemented this interface to create the object and where is that implementation?</p>
  
  <p>Here is the servlet xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:mvc="http://www.springframework.org/schema/mvc"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
  
         &lt;bean id="productManager" class="com.companyname.springapp.service.SimpleProductManager"&gt;
           &lt;property name="products"&gt;
              &lt;list&gt;
                  &lt;ref bean="product1"/&gt;
                  &lt;ref bean="product2"/&gt;
                  &lt;ref bean="product3"/&gt;
              &lt;/list&gt;
           &lt;/property&gt;
         &lt;/bean&gt;
  
         &lt;bean id="product1" class="com.companyname.springapp.domain.Product"&gt;
           &lt;property name="description" value="Lamp"/&gt;
           &lt;property name="price" value="5.75"/&gt;
         &lt;/bean&gt;
  
         &lt;bean id="product2" class="com.companyname.springapp.domain.Product"&gt;
           &lt;property name="description" value="Table"/&gt;
           &lt;property name="price" value="75.25"/&gt;
         &lt;/bean&gt;
  
         &lt;bean id="product3" class="com.companyname.springapp.domain.Product"&gt;
           &lt;property name="description" value="Chair"/&gt;
           &lt;property name="price" value="22.79"/&gt;
         &lt;/bean&gt;
  
         &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
           &lt;property name="basename" value="messages"/&gt;
         &lt;/bean&gt;
  
         &lt;!-- Scans the classpath of this application for @Components to deploy as beans --&gt;
         &lt;context:component-scan base-package="com.companyname.springapp.web" /&gt;
  
         &lt;!-- Configures the @Controller programming model --&gt;
         &lt;mvc:annotation-driven/&gt;
  
         &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
           &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"&gt;&lt;/property&gt;
           &lt;property name="prefix" value="/WEB-INF/views/"&gt;&lt;/property&gt;
           &lt;property name="suffix" value=".jsp"&gt;&lt;/property&gt;        
         &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I don't if this helps but I'm using Tomcat 7.0 and whole code is in here: <a href="http://docs.spring.io/docs/Spring-MVC-step-by-step/" rel="nofollow">http://docs.spring.io/docs/Spring-MVC-step-by-step/</a></p>