Ambiguous mapping. Cannot map 'xxxController' method


  @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);
    }

問題就可以解決啦!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM