Сопоставление запросов не работает после обновления до Spring boot 2.x

У меня есть следующий контроллер, который хорошо работал в Spring boot 1.x:

@Log4j2
@RestController
@RequestMapping(value = "/delivery/{id}")
public class DeliveryController {

    @Autowired
    private DeliveryService deliveryService;

    /**
     * request mapping of http GET method.
     *
     * @param id    
     * @param serviceId id
     * @param accessKey password
     * @param request   use for log output only
     * @return MyDeliveryDto data exist 200(OK) : data not exist 204(NO_CONTENT)
     * @throws ServiceUnavailableException When the maintenance flag is true in the application.yml.
     * @throws UnAuthorizedException       serviceid and accessKey invalid.
     * @throws ForbiddenException          serviceID not registered in application.yml.
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET)
    public ResponseEntity<MyDeliveryDto> get(@PathVariable Long id,
                                             String serviceId,
                                             String accessKey,
                                             HttpServletRequest request)
            throws ServiceUnavailableException, UnAuthorizedException, ForbiddenException {
        MyDeliveryDto dto = deliveryService.select(id, serviceId, accessKey);
        log.info("response dto : {}, serviceId : {}", dto, serviceId);
        if (Objects.isNull(dto)) {
            return new ResponseEntity<>(HttpStatus.NO_CONTENT);
        }
        return new ResponseEntity<MyDeliveryDto>(dto, HttpStatus.OK);
    }
}

Но после обновления до Spring boot 2.0.4 я получаю следующую ошибку:

{
    "timestamp": "2018/08/10T10:35:59.459+0900",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/mydata-api/delivery/123"
}

Я что-нибудь пропустил при переходе на новую версию?

@ResponseBody дублируется, необходимо его удалить
lucumt 10.08.2018 03:45

да, тоже пробовал, все та же проблема

Maddy 10.08.2018 04:22
1
2
587
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Обнаружил проблему - Конфигурация пути контекста была перемещена в server.servlet.context-path, поэтому старый server.context-path устарел.

Другие вопросы по теме