@PathVariable과 @RequestParam을 활용한 DELETE 메서드 구현
코드
controller/DeleteController.java
package com.springboot.hello.controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1/delete-api")
public class DeleteController {
//@PathVariable과 @RequestParam을 활용한 DELETE 메서드 구현
@DeleteMapping(value = "/{var}")
public String DeleteVariable(@PathVariable String var) {
return var;
}
}
실행 결과

@RequestParam을 활용한 DELETE 메서드 구현
코드
package com.springboot.hello.controller;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/v1/delete-api")
public class DeleteController {
//@PathVariable과 @RequestParam을 활용한 DELETE 메서드 구현
@DeleteMapping(value = "/{var}")
public String DeleteVariable(@PathVariable String var) {
return var;
}
//@RequestParam을 활용한 DELETE 메서드 구현
@DeleteMapping(value = "/request1")
public String getRequestParam1(@RequestParam String email) {
return "email : " + email;
}
}
실행 결과
