我有这段代码,我想在找不到资源的情况下抛出异常Menu menu = menuService.findById(addMenuAmount.getMenuId())
.orElseThrow(com.tdk.web.exception.ResourceNotFoundException(“menu " +
addMenuAmount.getMenuId() + " not found "));但我得到一个编译错误:com.tdk.web.exception cannot be resolved to a type
1 回答
肥皂起泡泡
TA贡献1829条经验 获得超6个赞
试试这个并确保它com.tdk.web.exception.ResourceNotFoundException
是可访问的
Menu menu = menuService.findById(addMenuAmount.getMenuId()) .orElseThrow(() -> new com.tdk.web.exception.ResourceNotFoundException("menu " + addMenuAmount.getMenuId() + " not found "));
注意 lambda() ->
和引号"menu "
。
添加回答
举报
0/150
提交
取消