Spring Boot 2.1.9.RELEASE,当控制器扩展基本控制器时,控制器无法正常工作

时间:2019-10-12 12:18:16

标签: spring spring-boot spring-mvc

public abstract class BaseController<E extends BaseEntity> {

    @GetMapping("/find")
    public ServerResponse find() {
        return ServerResponse.success();
    }

}
@RestController
@RequestMapping("/api/department")
public class DepartmentController extends BaseController<Department> {

    @RequestMapping("/find2")
    @ResponseBody
    public ServerResponse find2() {
        return ServerResponse.success();
    }
}

localhost:Temp nicq$ http GET :8010/api/department/find
HTTP/1.1 200
Content-Length: 0
Date: Sat, 12 Oct 2019 12:12:13 GMT

localhost:Temp nicq$ http GET :8010/api/department/find2
HTTP/1.1 200
Content-Length: 0
Date: Sat, 12 Oct 2019 12:12:17 GMT

我期望响应正文中有一些json字符串,但它为空。

当我打开调试模式时,不执行基本查找方法。

我正在实现通用控制器。 :<< / p>

0 个答案:

没有答案