spring 4.3.x + spring-security 4.x 升级遇到的问题汇总

最近给一个项目升级依赖,spring 从 4.0 升级到 4.3,spring-security 从 3.x 升级到 4.x,把踩到的坑说一下:

  1. 升级 spring-security 遇到的编码问题:
    升级以后,某些页面莫名其妙中文显示乱码,之前没问题。这时候调整一下 web.xml 中 charsetfilter 的位置倒 spring-security 之前即可。

  2. 某些页面跨域问题:
    访问一些页面会提示: Refused to display ‘http://localhost:8080/xxx' in a frame because it set ‘X-Frame-Options’ to ‘DENY’. 在 http 配置中加入下面的配置。

    <headers>
            <frame-options policy="SAMEORIGIN" />
    </headers>
    
comments powered by Disqus