zoukankan      html  css  js  c++  java
  • 在用security或者filter,拦截器时,会出现302问题,或者静态资源读不到,样式无法加载的问题

    这次问题是因为用了springSecurity,本来项目正常,突然所有的bootstrap样式和jquery都加载不到了,后来配置了静态资源的过滤,就可以了,好奇为什么之前没加可以正常运行,配置如下

    http.formLogin()                    //  定义当需要用户登录时候,转到的登录页面。
    //.loginPage("/login.html") // 设置登录页面
    //.loginProcessingUrl("/user/login") // 自定义的登录接口
    .and()
    .authorizeRequests() // 定义哪些URL需要被保护、哪些不需要被保护
    .antMatchers("/index").permitAll() // 设置所有人都可以访问登录页面
    .antMatchers("/search","/static/**").permitAll()
    .anyRequest() // 任何请求,登录后可以访问
    .authenticated()
    .and()
    .csrf().disable(); // 关闭csrf防护

    对于CSS文件,

    rel是relationship的英文缩写
    stylesheet中style是样bai式的意duzhi思,sheet是表格之意,总起来是样式表的意思
    rel="stylesheet" 描述了当前页面dao与href所指定文档的关系.即说明的是,href连接的文档是一个新式表

    必须要加上

    rel="stylesheet",否则不会加载
  • 相关阅读:
    【xinsir】githook之precommit分享
    node进程一些信号的意义
    ES6篇
    Webpack4篇
    Node篇
    Vuex篇
    WebStorage篇
    HTML5篇
    html5语义化标签大全
    emmet语法
  • 原文地址:https://www.cnblogs.com/w123w/p/13641904.html
Copyright © 2011-2022 走看看