title: Spring MVC @GetMapping("") is executed three times in the first request
body: <p>I've been working with Spring, I don't understand what the problem is. In the <strong>Test.class</strong> Spring MVC controller the code (the default controller, the first request will receive it) in the get request the code is executed three times this method includes 3 threads or 3 get requests.
  Synchronized method and <code>SingleThreadModel</code> interface don't help, so I think the problem is with three requests?
  If I execute the code in a different controller (not in the default fetch request) everything works good.</p>
  <p><strong>Test.class</strong></p>
  <pre><code>@Controller
  public class Test {
  
  @GetMapping(&quot;&quot;)
  public String hello(ModelMap model) {
  
         System.out.println(&quot;method hello said 'yes'&quot;);  //runs twice
  
         return &quot;index&quot;;
      }
  }
  </code></pre>
  <p><strong>web.xml</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;web-app version=&quot;4.0&quot; xmlns=&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/javaee
     http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&quot;&gt;
  
  
  &lt;display-name&gt;Spring MVC&lt;/display-name&gt;
  
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;PredictWeather&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;classpath:servletsConfig.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;PredictWeather&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  <p><strong>servletsConfig.xml</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
         xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
         xsi:schemaLocation=&quot;
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd&quot;&gt;
  
      &lt;context:component-scan base-package=&quot;servlets&quot;/&gt;
  
      &lt;bean class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&gt;
          &lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/&quot;/&gt;
          &lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot;/&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  <p><strong>logs</strong>
  <img src="https://i.stack.imgur.com/cZVhS.png" alt="1" />
  Perhaps someone has come across, or knows how to solve the problem, thanks for any answer! I ask the question for the first time, perhaps it is poorly formulated</p>