我不需要用到模板,所以把访问定向到static/index.html静态页面去.
@RequestMapping("/")
public String index() {
return "redirect:/index.html";
}
这么简单的语句在eclipse下把项目当程序运行提示404错误.
但gradle 构建的程序用命令行java -jar build/libs/xxx.jar又正常能访问到.
是什么道理?或者有其他替代方案吗?
If it is just a simple page jump, you can inherit the
WebMvcConfigurerAdapter
类,覆盖addViewControllers
method and add ViewController for configuration.Reporting 404 is an obvious project deployment problem~, search for contextpath related information