spring mvc : request mapping
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.example.springmvc.basic.requestmapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping/users")
|
||||
public class MappingClassController {
|
||||
/**
|
||||
* GET /mapping/users
|
||||
*/
|
||||
@GetMapping
|
||||
public String users() {
|
||||
return "get users";
|
||||
}
|
||||
/**
|
||||
* POST /mapping/users
|
||||
*/
|
||||
@PostMapping
|
||||
public String addUser() {
|
||||
return "post user";
|
||||
}
|
||||
/**
|
||||
* GET /mapping/users/{userId}
|
||||
*/
|
||||
@GetMapping("/{userId}")
|
||||
public String findUser(@PathVariable String userId) {
|
||||
return "get userId=" + userId;
|
||||
}
|
||||
/**
|
||||
* PATCH /mapping/users/{userId}
|
||||
*/
|
||||
@PatchMapping("/{userId}")
|
||||
public String updateUser(@PathVariable String userId) {
|
||||
return "update userId=" + userId;
|
||||
}
|
||||
/**
|
||||
* DELETE /mapping/users/{userId}
|
||||
*/
|
||||
@DeleteMapping("/{userId}")
|
||||
public String deleteUser(@PathVariable String userId) {
|
||||
return "delete userId=" + userId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user