Refused to apply style from ‘http://localhost:8080/admin‘ because its MIME type (‘text/html‘) is not

SpringSecurity登录页面部分样式不存在

不显示样式界面

样式不显示
由于SpringSecurity对static下的静态资源进行了屏蔽,所以访问不到。
初始的security中放行静态资源的路径如下:

http
    .authorizeRequests()
    .antMatchers("/static/css/**", "/static/js/**","/static/image/**","/static/lib/**",  "**/favicon.ico").permitAll();

重启项目登录页面样式依旧不起作用。
发现前端thymeleaf调用静态资源路径不需要加static,于是把放行静态资源路径修改成:

http
	.authorizeRequests()
	.antMatchers("/css/**", "/js/**","/image/**","/lib/**",  "**/favicon.ico").permitAll()

重启项目,登陆界面样式显示如下:
在这里插入图片描述
问题解决!!!


版权声明:本文为qq_45101612原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。