Spring boot 在 webapp 文件夹下找不到索引.html
我从 spring.io 阅读了以下文档,它说但是当我放置索引时.html字符串下的文件刚刚呈现。目前在webapp下,我正在使用AngularJS。By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath
/resources
index
index.html
MvcConfiguration
@Configuration
public class MvcConfig {
@Bean
InternalResourceViewResolver viewResolver(){
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/webapp/");
resolver.setSuffix(".html");
return resolver;
}
}
索引页的宁静服务
@RestController
public class IndexController {
@RequestMapping("/")
public String index(){
System.out.println("Looking in the index controller.........");
return "index";
}
}
在我的IDE控制台上,我确实看到从IndexController打印出来的,在Chrome开发工具中的网络下,我只看到。Looking in the index controller......
localhost 200
索引.html
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div ng-view></div>
<div>Angular seed app: v<span app-version></span></div>