title: How to use multiple controllers in Spring application?
body: <p>I'm trying to use two controllers to process requests in my Spring application, but is not working as expected:</p>
  
  <p><strong>Controller1</strong> is correctly processing the requests:</p>
  
  <pre><code>@Controller
  @RequestMapping("/appclient")
  public class Controller1 {
     ...
  }
  </code></pre>
  
  <p><strong>Controller2</strong> is not processing any message:</p>
  
  <pre><code>@Controller
  @RequestMapping("/webclient")
  public class Controller2 {
  
      @RequestMapping(value = "/product", method = RequestMethod.GET)
      public ModelAndView addProduct () {
          // Do something
      }
  }
  </code></pre>
  
  <p>I'm using Postman to test my application and I'm getting the following error, meaning there's not controller action defined for <em>"/webclient/product"</em>, which is not true.</p>
  
  <pre><code>{
    "timestamp": 1497048933216,
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/webclient/product"
  }
  </code></pre>
  
  <p>If I modify <strong>Controller1</strong> so that it can process <em>"/webclient/product"</em>, it works, but is not the way I want to do this.</p>
  
  <p>Any idea why Controller2 is not working?</p>
  
  <p><strong>EDIT</strong>: Here is the main class</p>
  
  <pre><code>@SpringBootApplication
  public class MyServerApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MyServerApplication.class, args);
      }
  }
  </code></pre>