Cộng đồng Hỏi & Đáp của Inflearn
totalPrice
Viết
·
413
2
안녕하세요 15:48 보시면
totalPrice 값이 나오는데 이 메소드는 언제 호출이 된건가요? 따로 호출해 준적이없는거 같습니다
==========
@GetMapping("/api/v1/simple-orders")
public List<Order> ordersV1(){
List<Order> all = orderRepository.findAllByString(new OrderSearch());
return all;
}
===========
public int getTotalPrice(){
int totalPrice = 0 ;
for(OrderItem orderItem : orderItems){
totalPrice+=orderItem.getTotalPrice();
}
return totalPrice;
}
javaspringspring-bootJPA
Câu trả lời 2
1
네 특별한 설정한 것 없이 테스트해봤는데 반환하는것으로 보아 내부에서 Jackson 라이브러리가 동작한 것으로 보입니다.
참고: https://mommoo.tistory.com/83
0






객체를 JSON으로 반환 하면 자동으로 해당 객체의 모든 getXX메서드를 호출하는건가요 ?!!