我在Spring Boot中有一个RestController示例:
@RestController
@RequestMapping("/api")
class MyRestController
{
@GetMapping(path = "/hello")
public JSONObject sayHello()
{
return new JSONObject("{'aa':'bb'}");
}
}
I am using the JSON library org.json
当我点击API /hello
时,我收到一个异常,说:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is JAVAlang.IllegalArgumentException:未找到要返回的转换器] with root cause
JAVAlang.IllegalArgumentException:未找到要返回的转换器
What is the issue? Can someone explain what exactly is happening?