jjzjj

HttpMediaTypeNotAcceptableExcepti

全部标签

java - Spring @ExceptionHandler 和 HttpMediaTypeNotAcceptableException

我有一个用@ControllerAdvice注释的类,其中有这个方法:@ExceptionHandler(ResourceNotFoundException.class)@ResponseStatus(HttpStatus.NOT_FOUND)@ResponseBodypublicExceptionInforesourceNotFoundHandler(ResourceNotFoundExceptionex){Listerrors=newArrayList();errors.add(newErrorContent(ExceptionsCodes.NOT_FOUND_CODE,null,

java - Spring 抛出 HttpMediaTypeNotAcceptableException : Could not find acceptable representation due to dot in url path

这个问题在这里已经有了答案:HttpMediaTypeNotAcceptableException:Couldnotfindacceptablerepresentationinexceptionhandler(2个回答)关闭5年前.最终编辑所以在研究了这个之后,因为我所看到的答案并不完全正确,我发现Spring在扩展匹配方面做了一些奇怪的事情。如果我提交这样的请求byNameOrAtlName/myStringHere.1或byNameOrAtlName/myStringHere.12一切都很好,但是byNameOrAtlName/myStringHere.123导致它像byNameO
12