title: Sending requests to rest webServices from swagger ends to 401 and unauthorized
body: <p>I am new in this project and I got a task to add some services to the project.
  First I created a package <code>NCDM</code> beside other  Rest packages and created my class <code>NCDMMemberController</code>:</p>
  
  <pre><code>    package ir.anarestan.ipc.controller.NCDM;
      import ir.anarestan.ipc.controller.helper.NCDM.NCDMMemberDTO;
      import ir.anarestan.ipc.controller.helper.ResponseDTO;
      import ir.anarestan.ipc.service.NCDM.NCDMMemberService;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.http.HttpStatus;
      import org.springframework.mobile.device.Device;
      import org.springframework.web.bind.annotation.*;
  
      import java.util.List;
  
  
      @RestController
      @RequestMapping(path = "/ncdmMember")
      public class NCDMMemberController {
  
  private final static Logger logger = LoggerFactory.getLogger(NCDMMemberController.class);
  
  @Autowired
  private NCDMMemberService ncdmMemberService;
  
  @ResponseBody
  @RequestMapping(value = "/getMember", method = RequestMethod.GET, produces = "application/hal+json")
  public Object get(@RequestBody NCDMMemberDTO memberDTO, Device device) {
      ResponseDTO responseDTO = new ResponseDTO();
      try {
          responseDTO.setSuccess(true);
          responseDTO.setHttpStatus(HttpStatus.OK.value());
          responseDTO.setResponseBody(ncdmMemberService.getMemberByMemberIdAndImei(memberDTO));
          return responseDTO;
      } catch (Exception e) {
          logger.info("error occurred!", e);
          responseDTO.setSuccess(false);
          responseDTO.setErrorMessage(e.getMessage());
          responseDTO.setHttpStatus(HttpStatus.EXPECTATION_FAILED.value());
          responseDTO.setResponseBody(null);
          return responseDTO;
      }
  }
  
  @ResponseBody
  @RequestMapping(value = "/saveMember", method = RequestMethod.POST, produces = "application/hal+json")
  public Object save(@RequestBody NCDMMemberDTO member, Device device) {
      ResponseDTO responseDTO = new ResponseDTO();
      try {
          ncdmMemberService.saveMember(member);
          responseDTO.setSuccess(true);
          responseDTO.setHttpStatus(HttpStatus.OK.value());
          responseDTO.setResponseBody(null);
          return responseDTO;
      } catch (Exception e) {
          logger.info("error occurred!", e);
          responseDTO.setSuccess(false);
          responseDTO.setErrorMessage(e.getMessage());
          responseDTO.setHttpStatus(HttpStatus.EXPECTATION_FAILED.value());
          responseDTO.setResponseBody(null);
          return responseDTO;
      }
  }
  }
  </code></pre>
  
  <p>but when I try to send request from swagger, I got the following response:</p>
  
  <pre><code>{
    "timestamp": 1579957861338,
    "status": 401,
    "error": "Unauthorized",
    "message": "Unauthorized",
    "path": "/ncdmMember/saveMember"
  }
  </code></pre>
  
  <p>And that happen when sendig request to the previous services has no error.
  Does anyone know what is the problem?Do I need to introduce my package/class somewhere?</p>
  
  <p>And when I copy one of the written services to the privious classes everything is ok.</p>
  
  <p>Any help would be appreciated.</p>