原因:
(4條消息) Spring Boot 默認跳轉到index.html的二種方式_NULL-CSDN博客_springboot 默認index.html
2. 在controller中配置
@GetMapping("/")
public String index(){
return "index";
}
應該使用@Controller而非@RestfulController,並且index.html需要放在templates文件夾中
3. 參考:(4條消息) Spring Boot 默認跳轉到index.html的二種方式_NULL-CSDN博客_springboot 默認index.html
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {