By default Spring Boot maps /error to BasicErrorController which populates model with error attributes and then returns 'error' as the view name to map application defined error pages.
To replace BasicErrorController with our own custom controller which can map to '/error', we need to implement ErrorController interface.
Example
The Controller
@Controller
public class MyAppController {
@RequestMapping("/")
public void handleRequest() {
throw new RuntimeException("test exception");
}
}