【发布时间】:2020-08-01 21:12:03
【问题描述】:
学习Spring Rest,有一些疑问:
@RestController
public class TestController {
@Autowired
private TestService testService;
@GetMapping("/test")
public int testTransaction(){
return 10;
}
}
上面的 sn-p 运行良好,返回响应 10。
@RestController("/test")
public class TestController {
@Autowired
private TestService testService;
@GetMapping
public int testTransaction(){
return 10;
}
}
对于上面的sn-p,给我一个错误如下:
threw exception No adapter for handler The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler with root cause
有什么想法吗?可能是什么原因..?我认为两者都应该工作,但以上一个不工作......
【问题讨论】:
标签: spring spring-boot rest spring-mvc spring-rest