title: spring 404 controller not found
body: <p>I have a problem with spring, because I receive 404 error not found.</p>
  
  <p>My web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0"&gt;
  
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/PROJECT_NAME/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/mvc-dispatcher-servlet.xml
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I have also mvc-dispatcher.xml file and my controller</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;context:annotation-config/&gt;
  &lt;mvc:annotation-driven/&gt;
  &lt;context:component-scan
          base-package="com.PROJECT_NAME.web.controllers"/&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and my controller</p>
  
  <pre><code>@Controller
  public class TestController {
  
  @RequestMapping(value="/test", method = RequestMethod.GET)
  public @ResponseBody
  ResponseEntity&lt;Boolean&gt; create() {
      return new ResponseEntity&lt;&gt;(true, HttpStatus.OK);
  }
  
  }
  </code></pre>
  
  <p>When I do query like localhost:8080/PROJECT_NAME/test I got 404 not found error. localhost:8080/PROJECT_NAME returns 200 status code
  What is wrong ?</p>