title: Spring MVC Restful Application error 404. Why?
body: <p>I'm making a RESTful app without a View. Using PostMan, I make a test Get request, but I keep getting 404.</p>
  <p>I put a breakpoint in the controller, but the request does not reach. I'm trying to make a service without a View and want to send and receive json requests in the future, but at this stage I need to check that requests reach the controllers. It doesn't work yet.</p>
  <p>there are already a lot of questions and answers on STO, but unfortunately they are all made with a View.</p>
  <p><strong>SpringConfig.java</strong></p>
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = &quot;ml.antanaks.school.concert&quot;)
  public class SpringConfig {
  }
  </code></pre>
  <p><strong>SpringMvcDispatcherServletInitializer.java</strong></p>
  <pre><code>public class SpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return null;
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return new Class[] {SpringConfig.class};
      }
  
      @Override
      protected String[] getServletMappings() {
          return new String[] {&quot;/&quot;};
      }
  }
  </code></pre>
  <p><strong>UserController.java</strong></p>
  <pre><code>@RestController
  @RequestMapping(&quot;/user&quot;)
  public class UserController {
  
      @GetMapping(&quot;/hello&quot;)
      public String hello() {
          return &quot;Hello&quot;;
      }
  }
  </code></pre>
  <p><strong>console</strong></p>
  <pre><code>/Users//Documents/apache-tomcat-10.0.5/bin/catalina.sh run
  [2021-04-21 01:02:18,072] Artifact natalyalearn:war exploded: Waiting for server connection to start artifact deployment...
  21-Apr-2021 01:02:20.562 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/10.0.5
  21-Apr-2021 01:02:20.564 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 30 2021 08:19:50 UTC
  21-Apr-2021 01:02:20.575 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.0.5.0
  21-Apr-2021 01:02:20.575 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
  21-Apr-2021 01:02:20.575 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Версия ОС:             10.15.7
  21-Apr-2021 01:02:20.575 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Архитектура:           x86_64
  21-Apr-2021 01:02:20.576 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Users/user/Library/Java/JavaVirtualMachines/corretto-1.8.0_282/Contents/Home/jre
  21-Apr-2021 01:02:20.576 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Версия JVM:            1.8.0_282-b08
  21-Apr-2021 01:02:20.576 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Amazon.com Inc.
  21-Apr-2021 01:02:20.576 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/user/Library/Caches/JetBrains/IntelliJIdea2021.1/tomcat/48517f15-6cdb-422a-a021-e59ff424c802
  21-Apr-2021 01:02:20.582 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /Users/user/Documents/apache-tomcat-10.0.5
  21-Apr-2021 01:02:20.583 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/user/Library/Caches/JetBrains/IntelliJIdea2021.1/tomcat/48517f15-6cdb-422a-a021-e59ff424c802/conf/logging.properties
  21-Apr-2021 01:02:20.589 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
  21-Apr-2021 01:02:20.589 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
  21-Apr-2021 01:02:20.590 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
  21-Apr-2021 01:02:20.590 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
  21-Apr-2021 01:02:20.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.password.file=/Users/user/Library/Caches/JetBrains/IntelliJIdea2021.1/tomcat/48517f15-6cdb-422a-a021-e59ff424c802/jmxremote.password
  21-Apr-2021 01:02:20.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.access.file=/Users/user/Library/Caches/JetBrains/IntelliJIdea2021.1/tomcat/48517f15-6cdb-422a-a021-e59ff424c802/jmxremote.access
  21-Apr-2021 01:02:20.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
  21-Apr-2021 01:02:20.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
  21-Apr-2021 01:02:20.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
  21-Apr-2021 01:02:20.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
  21-Apr-2021 01:02:20.596 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
  21-Apr-2021 01:02:20.596 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/user/Library/Caches/JetBrains/IntelliJIdea2021.1/tomcat/48517f15-6cdb-422a-a021-e59ff424c802
  21-Apr-2021 01:02:20.596 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/user/Documents/apache-tomcat-10.0.5
  21-Apr-2021 01:02:20.598 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/user/Documents/apache-tomcat-10.0.5/temp
  21-Apr-2021 01:02:20.612 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/Users/user/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
  21-Apr-2021 01:02:21.879 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [&quot;http-nio-8080&quot;]
  21-Apr-2021 01:02:21.931 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [2533] milliseconds
  21-Apr-2021 01:02:22.123 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
  21-Apr-2021 01:02:22.124 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.0.5]
  21-Apr-2021 01:02:22.151 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [&quot;http-nio-8080&quot;]
  21-Apr-2021 01:02:22.318 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [386] milliseconds
  Connected to server
  [2021-04-21 01:02:22,694] Artifact natalyalearn:war exploded: Artifact is being deployed, please wait...
  21-Apr-2021 01:02:30.127 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  [2021-04-21 01:02:30,231] Artifact natalyalearn:war exploded: Artifact is deployed successfully
  [2021-04-21 01:02:30,232] Artifact natalyalearn:war exploded: Deploy took 7,538 milliseconds
  21-Apr-2021 01:02:32.162 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Installing a web application in a folder [/Users/user/Documents/apache-tomcat-10.0.5/webapps/manager]
  21-Apr-2021 01:02:32.234 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/user/Documents/apache-tomcat-10.0.5/webapps/manager] has finished in [72] ms
  </code></pre>