반응형 @ScriptAssert()1 [Spring Boot] : Bean Validation Obejct 오류 특정 필드가 아닌 오브젝트 관련 오류는 @ScriptAssert()를 활용하면 된다. @ScriptAssert(lang = "javascript", script = "_this.price * _this.quantity >= 10000", message = "총 합이 만원이 넘게 해주세요.") 이렇게 어노테이션을 활용해서 써주면 되는데 기능이 너무 약해서 그냥 이 부분은 Java 코드로 가져오는 게 낫다고 한다. //특정 필드가 아닌 복합 룰 검증 if (item.getPrice() != null && item.getQuantity() != null) { int resultPrice = item.getPrice() * item.getQuantity(); if(resultPrice < 10000) { bin.. 2022. 2. 16. 이전 1 다음 반응형