且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MethodArgumentNotValidException之后获取无效字段的值

更新时间:2021-08-19 20:02:15

不会存储不正确的值,而且在前面使用实体对象是不好的做法。你应该创建一个DTO对象,而不是将它发送给你的应用程序。检查它(在这里你可以添加不正确的工作人员记录),然后处理它到你的实体对象,并尝试保存或任何你想做的事情。

Your entity won't store incorrect values furthermore it is bad practise to use entity object on the front. You should create a DTO object, than send it to your application. Check it (here you could add incorrect staff to logger) and then process it to your entity object and try to save or whatever you want to do.