본문 바로가기
Back-End/Spring

MVC 컨트롤러 List로 받기

by hongdor 2021. 3. 14.
728x90

1. Class

@Getter @Setter
@ToString
public class MemberDelete{
    Long id;
}

 

 

2. 컨트롤러 ( Delete 메소드일 때 )

@Transactional
@DeleteMapping("/api/v1/members")
public void deleteMember(@RequestBody List<MemberDelete> memberRequest){}

 

 

3. 전송 Json 

[
    {
        "id" : 1
    },
    {
        "id" : 2
    }
]

 

728x90

댓글