为了账号安全,请及时绑定邮箱和手机立即绑定

spring boot怎么直接访问html?

spring boot怎么直接访问html?

慕标5832272 2018-06-20 10:17:02
spring boot怎么直接访问html.就是不走后台controller。现在是想要访问一个页面,必须走controller,controller方法就直接return “myhtml”。方法就直接返回页面的string了。怎么可以配置,直接访问html页面,不走controller
查看完整描述

3 回答

?
尚方宝剑之说

TA贡献1788条经验 获得超4个赞

在resource目录下新建一个static目录,放到static目录下即可

查看完整回答
反对 回复 2018-07-12
?
潇湘沐

TA贡献1816条经验 获得超6个赞

放到静态资源目录下

查看完整回答
反对 回复 2018-07-12
?
素胚勾勒不出你

TA贡献1827条经验 获得超9个赞

设置好读取静态文件的位置:

spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/

然后就可以,直接访问html了


查看完整回答
反对 回复 2018-07-12
  • 3 回答
  • 0 关注
  • 157 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信