最近在学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. C# 篇基础知识1——编译、进制转换、内存单位、变量

    编译:C#语言要经过两次编译,程序员编写好源代码后进行第一次编译,将源代码编译为微软中间语言(MSIL),生成可以发布的应用软件:当用户使用软件时,MSIL代码会在首次载入内存后进行第二次编译,中间语 ...

  2. MyEclipse Hibernate逆向工程的使用

    简介MyEclipse自带很多非常实用的工具,本次将介绍Hibernate工具的使用.1.首先打开MyEclipse的Hibernate视图 2.然后在左上角的DB Browser视图中,右键,新建数 ...

  3. springboot中文官方文档

    springboot中文官方文档 https://www.breakyizhan.com/springboot/3028.html spring框架 https://www.breakyizhan.c ...

  4. java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)(转)

    Caused by: java.io.FileNotFoundException: rmi_keystore.jks (没有那个文件或目录) 解决方法:修改jmeter.properites: ser ...

  5. tomcat报错catalina.sh: line 401: /usr/java/jdk1.7.52/bin/java: No such file or directory(转)

    原文:https://blog.csdn.net/reblue520/article/details/52588825 将生产服务器的Tomcat目录打包过来后解压后,启动Tomcat后,发现如下问题 ...

  6. Ubuntu操作系统编写zabbix的启动管理脚本

    Ubuntu操作系统编写zabbix的启动管理脚本 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.修改zabbix的pid存放路径 1>.创建存放zabbix的pid目录 ...

  7. P1066 图像过滤

    P1066 图像过滤 转跳点:

  8. vSphere 高级特性FT配置与管理

    内容预览: 1. Fault Tolerance 的工作方式 2. 5.X版本FT使用的vLockstep技术 3. 6.X版本FT使用的Fast Checkpointing技术 4. FT不支持的v ...

  9. mysql性能优化及 Comparison method violates its general contract

    项目上嵌套结果集查询,查询的列表再根据每个id进行查询计算,嵌套的sql如下: SELECT SUM(IFNULL(t.out_rate,0)) totalOutRate, SUM(IF(IFNULL ...

  10. 小程序包大小超过2M的解决方法

    小程序的包被限制在2M以下, 超出的时候点击预览, 发现报错: Error: 代码包大小为 3701 kb,上限为 2048 kb,请删除文件后重试 1. 优化代码, 删除掉不用的代码 2. 图片压缩 ...