1

I have Swagger added to the project and it works https://zapodaj.net/217c8a0dcf348.png.html. After adding the controller

@RestController(value = "/register")
public class RegisterRestController {
...

@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public
ResponseEntity<Void> register(
        @RequestBody final RegisterDto registerDTO
) {
    this.userService.createUser(registerDTO);

    final HttpHeaders httpHeaders = new HttpHeaders();
    return new ResponseEntity<>(httpHeaders, HttpStatus.CREATED);
}
}

Swagger UI stops working https://zapodaj.net/c60c3029b0905.png.html. Kicks

"error": "Method Not Allowed",
"message": "Request method 'GET' not supported",
"status": "405"

I found a similar thread on stackoverflow, but I do not know how he can help me. What's up with this Swagger?

sdfgsdgsgr
  • 95
  • 1
  • 1
  • 8

1 Answers1

0

You are missing a mapping to the method I added "/register"

@PostMapping("/register")
@ResponseStatus(HttpStatus.CREATED)
public
ResponseEntity<Void> register(
    @RequestBody final RegisterDto registerDTO
)
Chol Nhial
  • 1,327
  • 1
  • 10
  • 25