Ambiguous mapping. Cannot map ‘xxxController’ method
- 2020 年 8 月 10 日
- 笔记
- JAVA, mybatis-plus, Spring Boot
@GetMapping public JsonResp<List<DtoLandRegion>> getLandRegionList() { List<DtoLandRegion> regions = service.getLandRegionList(); return JsonResp.newSuccessResp(regions); } @GetMapping public JsonResp<List<DtoFactorType>> getFactorTypeList() { List<DtoFactorType> factors = service.getFactorTypeList(); return JsonResp.newSuccessResp(factors); }
上面的代码中,都有@GetMapping,并没有指定value值,所以重复了,导致映射模糊。
解决方法,指定value值。
@GetMapping("/getLandRegionList") public JsonResp<List<DtoLandRegion>> getLandRegionList() { List<DtoLandRegion> regions = service.getLandRegionList(); return JsonResp.newSuccessResp(regions); } @GetMapping("/getFactorTypeList") public JsonResp<List<DtoFactorType>> getFactorTypeList() { List<DtoFactorType> factors = service.getFactorTypeList(); return JsonResp.newSuccessResp(factors); }
问题就可以解决啦!