**
Answer: open spring boot application. go to application.properties in **src/main/resources ** following white label "enable" by default.
1.
server.error.whitelabel.enabled=false
server.error.include-stacktrace=always
write following contoller class.
2.
**
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class CustomErrorController implements ErrorController {
@RequestMapping("/error")
public String handleError(HttpServletRequest request, Model model) {
return "login";
}
@Override
public String getErrorPath() {
return "/error";
}
}
**