在SSM中一般启动服务器后,会自动跳转到 默认的欢迎页或者通过web.xml中的welcome-file-list指定的欢迎页。但在Springboot中则无法自动跳转,因此需要自定义一个controller来实现,实现代码如下:
@Component
public class JumpController implements ApplicationRunner{
@Override
public void run(ApplicationArguments args) throws Exception {
Runtime.getRuntime().exec("cmd /c start http://localhost:8080/");
}
}
@Controller
public class UserController {
@Autowired
IUserService userService;
@RequestMapping("/")
public String index(){
return "login";
}
}



