able to hit get method endpoint but unable to hit POST method

417 views Asked by At

following is my code

@RestController
@RequestMapping(value="/users")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value ="/registration",method = RequestMethod.POST)
    public void addUser(@RequestBody @Valid UserDTO userDTO) {
        System.out.println("from Post");
        userService.saveUser(userDTO);
    }

    @RequestMapping(value = "/dashboard/getUserDetails", method = RequestMethod.GET)
    public List<UserDTO> getUsers() {
        System.out.println("inside controller");
        return userService.getUsers();
    }}

in the above code when i am trying to hit get endpoint its working and when i am trying to hit POST endpoint it is throwing 404.

please help me in solving the problem

0

There are 0 answers