码迷,mamicode.com
首页 > 编程语言 > 详细

springboot访问静态资源

时间:2019-02-15 10:20:44      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:ring   err   pat   handlers   res   vcc   页面   xtend   eset   

@Configuration
public class WebMvcConfiguration extends WebMvcConfigurationSupport {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }
}

templates中的html页面这样引用

<link rel="stylesheet" type="text/css" href="static/css/reset.css"/>
<link rel="stylesheet" type="text/css" href="static/css/reset.css"/>

static 下web中的html这样引用
<script src="../js/jquery-3.3.1.min.js"></script>

springboot访问静态资源

标签:ring   err   pat   handlers   res   vcc   页面   xtend   eset   

原文地址:https://www.cnblogs.com/yunqing/p/10382010.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!