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