最近在学SpringBoot,在整合Thymeleaf的时候,配置拦截器。教学上讲SpringBoot已经做好了静态资源映射,所以不需要特地去做排除拦截

以下代码就是我在做登录拦截的时候配置的拦截。

@Override
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/","/index.html","/user/login");
} 一开始,资源都能映射,一切感觉都OK,上午搞定后吃个饭,下午继续搞的时候,发现有的样式突然失效了。
在谷歌浏览器检查问题的时候,发现了这句话,
DevTools failed to parse SourceMap: -------------------------------------------------------------------------------------------
普遍解释是
在现在写网站的时候,如果有很多的javascript文件,拿ASP.NET NVC来说,
在渲染内容到客户端浏览器的时候,如果你使用一些Bundle类的话,能够合并并且压缩那些js文件,
并且去除其中的空格等元素,从而减小文件的容量,提高网页的反应速度
但是这样一样造成的问题就是在浏览器端无法对js文件进行调试,因为进过压缩的文件很紧凑,没有空格与换行。
概括来讲,SourceMap就是如何把压缩后的js代码映射成格式化代码的方法。
当你在Production环境部署代码的时候,伴随着压缩与优化话的js代码
还要有一个包含原始js代码的sourcemap文件。当客户端浏览器Chrome在收到这个压缩后的js文件后,
它会自动的去寻找服务器上相关的sourcmap文件并把压缩的js代码转换成格式规范的js代码。 以上摘抄与https://blog.csdn.net/sundacheng1989/article/details/51118865
----------------------------------------------------------------------------------
总之所有的解决办法大概都是这幅图

但是我在关掉开发者工具额这两个选项后,出现了另一个报错

Resource interpreted as Stylesheet but transferred with MIME

这个错误百度了一下,各种解决办法。头都大了。然后在恼火中一直点击
Resource interpreted as Stylesheet but transferred with MIME后面的地址链接,一直被我的拦截器拦住跳回登录
页的时候。在想是不是拦截器的问题。注释了一下,发现就是这逼在搞鬼。我也不知道SpringBoot到底有没有对静态资源自动映射。
总之我把拦截的代码加上了红字的代码就OK了。
@Override
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/","/index.html","/user/login","asserts/**","webjars/**");
}
以上是我的解决方法
 


Resource interpreted as Stylesheet but transferred with MIME || DevTools failed to parse SourceMap:的更多相关文章

  1. odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:

    odoo8   页面内容显示一半,  web 控制台显示错误  Resource interpreted as Stylesheet but transferred with MIME type ap ...

  2. Resource interpreted as Stylesheet but transferred with MIME type text/plain

    今天碰到了Resource interpreted as Stylesheet but transferred with MIME type text/plain 这个错误. 原因:在web中配置了f ...

  3. Django 导入css文件,样式不起作用。Resource interpreted as Stylesheet but transferred with MIME type application/x-css

    笔者今天在模板中加载css文件时,发现 css样式能够下载再来却无法起作用,而且,图片.js都能够正常使用. 并且 浏览器提示: Resource interpreted as Stylesheet ...

  4. 样式加载不出来,浏览器控制台报错:Resource interpreted as Stylesheet but transferred with MIME type text/html

    写登录的时候出现的问题,样式时好时坏,浏览器控制台看到的信息是: Uncaught SyntaxError: Unexpected token <Resource interpreted as ...

  5. Resource interpreted as Stylesheet but transferred with MIME type text/html: css失效

    异常信息: Resource interpreted as Stylesheet but transferred with MIME type text/html: 可能原因 过滤器或者某个地方对所有 ...

  6. css不起作用报错:Resource interpreted as Stylesheet but transferred with MIME type text/html

    解决:https://blog.csdn.net/sky_cui/article/details/86703706 找了好久........

  7. Chrome: Resource interpreted as Font but transferred with MIME type font/x-woff

    最近,项目中加入了Bootstrap进行界面优化,但是,项目加载运行之后,控制台总是提示以下错误信息: GET http://localhost:8080/.../fonts/fontawesome- ...

  8. Resource interpreted as Script but transferred with MIME type text/plain:

    我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...

  9. Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法

    http://www.2cto.com/os/201312/262437.html 安装了VS2012之后,chrome在加载页面的时候会报 Resource interpreted as Scrip ...

随机推荐

  1. 前端学习笔记系列一:13new Date()的参数

    前两天发现手机页面的倒计时在Android上正常显示,在iPhone却不能显示. 后来又发现在ff和ie里也不显示.(以前只在chrome里看过,显示正常). 后来同事改了new Date()里字符串 ...

  2. angularJS 获取数据及 排序

  3. jumpserver手动配置文档

    1.环境  centos7.6   硬盘 200G  cpu  8核心  内存 32G (本地测试的时候,有报错,原因为虚拟机配置不够,此时为在pve虚拟化上面做的linux系统) 2.https:/ ...

  4. Vue项目中v-for无法渲染数据

    在Vue项目中,我们想要实现下面的布局效果 后端返回的数据格式如下,可以看出产品列表五张图的数据位于同一个数组中 而我的html结构如下: 我希望直接渲染左边一张大图,然后右边的四张小图通过v-for ...

  5. NPM概述及使用简介

    什么是 NPM npm之于Node,就像pip之于Python,gem之于Ruby,composer之于PHP. npm是Node官方提供的包管理工具,他已经成了Node包的标准发布平台,用于Node ...

  6. 2017 青岛现场赛 I The Squared Mosquito Coil

    Lusrica designs a mosquito coil in a board with n × n grids. The mosquito coil is a series of consec ...

  7. HiBench成长笔记——(7) 阅读《The HiBench Benchmark Suite: Characterization of the MapReduce-Based Data Analysis》

    <The HiBench Benchmark Suite: Characterization of the MapReduce-Based Data Analysis>内容精选 We th ...

  8. 洛谷P2089 烤鸡

    标签:暴力,枚举 题目背景 猪猪 Hanke 得到了一只鸡. 题目描述 猪猪 Hanke 特别喜欢吃烤鸡(本是同畜牲,相煎何太急!)Hanke 吃鸡很特别,为什么特别呢?因为他有 10 种配料(芥末. ...

  9. 初学Java(1)

    1.Java基本数据类型: 2.Java的main方法: 被static修饰,类名与文件名相同:void:方法的返回值,无返回值:main方法是程序的入口,有且只有一个: String[] args: ...

  10. 说说我当初是如何学Linux的

    今天我就说说我当初是如何从一名普通桌面维护工程师,通过学习和努力转成Linux运维工程师的,以及作为Linux运维工程师需要一些什么技能和知识,希望可以帮到一些对Linux有兴趣或者想往Linux这个 ...