title: No mapping for request with mockmvc
body: <p>Currently struggling with problem when I get 'mapping error for request' with following controller/test configuration.
  Controller:</p>
  <pre><code>@Slf4j
  @Validated
  @RestController
  @RequiredArgsConstructor
  public class AdtechController {
  
  private final AdtechService adtechService;
  
  @PostMapping(value = &quot;/subscriber/session&quot;)
  public ResponseEntity&lt;ResponseDto&gt; submitSession(@RequestBody RequestDto requestDto) {
      log.trace(&quot;execute submitSession with {}&quot;, requestDto);
      ResponseDtoresponse = adtechService.submitSession(requestDto);
      return new ResponseEntity&lt;&gt;(response, HttpStatus.OK);
  }
  
  @ExceptionHandler(AdtechServiceException.class)
  public ResponseEntity&lt;AdtechErrorResponse&gt; handleAdtechServiceException(AdtechServiceException e) {
      return new ResponseEntity&lt;&gt;(new AdtechErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
  }
  
  }
  </code></pre>
  <p>Test:</p>
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest
  @AutoConfigureMockMvc
  @SpringJUnitConfig({AdtechTestConfig.class})
  public class AdtechControllerTest {
  
  private static final ObjectMapper OBJECT_MAPPER = JsonUtil.getJackson();
  
  @Autowired
  private MockMvc mockMvc;
  
  @Test
  public void testSubmitSession() throws Exception {
      RequestDto requestDto = new RequestDto ();
      requestDto.setKyivstarId(&quot;1123134&quot;);
      requestDto.setMsisdn(&quot;123476345242&quot;);
      requestDto.setPartnerId(&quot;112432523&quot;);
      requestDto.setPartnerName(&quot;125798756&quot;);
      String request = OBJECT_MAPPER.writeValueAsString(requestDto);
      System.out.println(&quot;REQUEST: &quot; + request);
      String response = OBJECT_MAPPER.writeValueAsString(new ResponseDto(&quot;123&quot;));
      System.out.println(&quot;RESPONSE: &quot; + response);
      mockMvc.perform(post(&quot;/subscriber/session&quot;)
              .content(MediaType.APPLICATION_JSON_VALUE)
              .content(request))
              .andDo(print())
              .andExpect(status().isOk())
              .andExpect(content().string(containsString(response)));
  
  }
  
  }
  </code></pre>
  <p>Configuration:</p>
  <pre><code>@Configuration
  public class AdtechTestConfig {
  
  @Bean
  public AdtechService adtechTestService() {
      return requestDto -&gt; new AdtechResponseDto(&quot;123&quot;);
  }
  
  }
  </code></pre>
  <p>After test execution I get <strong>No mapping for POST /subscriber/session</strong></p>
  <p>The reason for the struggle is that my code from other modules with the same configuration works fine. Can somebody point out what am I missing ? Thanks in advance!</p>