I'am using Spring boot and Tomcat7 to build a vehicle management system.
The base path is localhost:8080/vehicle
My server setting:
server.contextPath=/vehicle
My IndexController:
@RequestMapping("/")
public class IndexController extends BaseController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(Model model) {
return "redirect:/login";
}
}
But when I go straight to get this view, my path is ...../login
instead of ..../vehicle/login
And so it returns 404 Error.
Also when I tried to use return "redirect:/vehicle/login";
it still goes to ...../login
.
So what is wrong with my code. Why the server can't recognize the contextPath.