中国十大购物网站排行榜,滨江做网站,网站可以做固定资产吗,合肥seo软件templates里的静态资源无法访问#xff0c;需要写mvc的配置类或者改application.xml配置文件实现首页访问。这两个方式用其中一种即可#xff0c;否则会冲突。 14.1 首页跳转方式一 创建配置类#xff0c;在config包中创建一个mvc的配置类#xff1a;
package jiang.com.s… templates里的静态资源无法访问需要写mvc的配置类或者改application.xml配置文件实现首页访问。这两个方式用其中一种即可否则会冲突。 14.1 首页跳转方式一 创建配置类在config包中创建一个mvc的配置类
package jiang.com.springbootstudy.config;import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;Configuration
public class MyMvcConfig implements WebMvcConfigurer {Overridepublic void addViewControllers(ViewControllerRegistry registry) {registry.addViewController(/).setViewName(index.html);}
}14.2 首页跳转方式二 修改application.yaml配置文件server: servlert: context-path: /xxx注意这个方式最好不要用不然无法使用mvc配置类进行跳转
server:port: 8080servlet:context-path: /kuangstudent:name: zhangsanage: 18arr: [zhangsan,李四]
spring:thymeleaf:cache: false