缺少 Accept 请求头,添加就好了.

    • curl 会自动添加请求头 accept: /
    • 自己写可能会遗落这一点。
      1. [2021-08-09 19:26:11.360] - [程序发生通用异常][Could not find acceptable representation]
      2. org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
      3. at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:251)
      4. at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:181)
      5. at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
      6. at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:124)
      7. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888)
      8. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
      9. at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
      10. at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
      11. at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
      12. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
      13. at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
      14. at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
      15. at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
      16. at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      17. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)