zoukankan      html  css  js  c++  java
  • SpringBoot 静态资源导入

    1、springboot下resources的静态资源的优先级

    resources > static > public

    EnableWebMvcConfiguration类下的

            protected void addResourceHandlers(ResourceHandlerRegistry registry) {
                super.addResourceHandlers(registry);
                if (!this.resourceProperties.isAddMappings()) {
                    logger.debug("Default resource handling disabled");
                } else {
                    ServletContext servletContext = this.getServletContext();
                    this.addResourceHandler(registry, "/webjars/**", "classpath:/META-INF/resources/webjars/");
                    this.addResourceHandler(registry, this.mvcProperties.getStaticPathPattern(), (registration) -> {
                        registration.addResourceLocations(this.resourceProperties.getStaticLocations());
                        if (servletContext != null) {
                            registration.addResourceLocations(new Resource[]{new ServletContextResource(servletContext, "/")});
                        }
    
                    });
                }
            }
    
  • 相关阅读:
    Git命令家底儿及Git数据通信原理详解
    git SSH keys
    TRIM函数
    c# List AddRange
    vtk第一个程序
    MFC CStatic类动态创建
    前端基础之BOM和DOM
    JavaScript
    前端CSS属性相关
    前端CSS
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/14448304.html
Copyright © 2011-2022 走看看