springboot访问静态资源

@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>


好文推荐:https://blog.csdn.net/gebitan505/article/details/70142025

posted @ 2019-02-15 10:12  云晴  阅读(145)  评论(0编辑  收藏  举报