I've been looking and with can't seem to find how to set a page for 404 errors. I can set them for errors that I throw. Like if I have baseurl/product/{key}
and the key is invalid I can throw that to a 404 but the user just enters a wrong url like baseurl/produckt/{key}
(note the misspelling) I can't seem to figure out how to catch that. I am using JavaConfig, not a web.xml.
I've tried something like
@PreAuthorize("permitAll()")
@GetMapping("/**")
public String error404(){
return "error404";
}
And that 'works' for detecting urls I don't have mapped, but it also makes other things behave wrong.