Bom dia pessoal, estou tendo problemas com a implementação do Swagger no meu pequeno microserviço, está dando o seguinte erro quando tento puxar a swagger-ui.html, segue o erro :
"" Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Dec 07 10:56:57 BRT 2023 There was an unexpected error (type=Not Found, status=404). ""
Dependência:
org.springdoc springdoc-openapi-ui 1.7.0Classe Main:
@SpringBootApplication public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
Classe Controller:
@RestController @RequestMapping("/v1/users") public class UserController {
@Autowired
private UserService userService;
@GetMapping
public ResponseEntity<Iterable<UserModel>> getUsers() throws Exception {
return ResponseEntity.ok(userService.getUsers());
}
@GetMapping("/{id}")
public ResponseEntity<UserModel> getUser(@PathVariable Long id) throws Exception {
return ResponseEntity.ok(userService.getUser(id));
}
@PostMapping
public ResponseEntity<UserModel> create(@RequestBody @Valid UserDTO userDto) throws Exception {
return ResponseEntity.status(HttpStatus.CREATED).body((userService.createUser(userDto)));
}
@PutMapping("/{id}")
public ResponseEntity<UserModel> update ( @RequestBody @Valid @PathVariable Long id, UserDTO userDto ) throws Exception {
return ResponseEntity.ok(userService.updateById(id, userDto));
}
@DeleteMapping("/{id}")
public ResponseEntity<UserModel> delete ( @PathVariable Long id, UserDTO userDto ) throws Exception {
return ResponseEntity.ok(userService.deleteById(id, userDto));
}
}