zoukankan      html  css  js  c++  java
  • spring security 注解和配置文件

    想必大家和我一样都卡在了 @RolesAllowed 注解 没有相对应的效果 ,这个问题也是硬生生卡了我两天 ,最终还是如愿的解决了, 下面就和大家来分享我的解决方案

    1.首先就是看自己的 applicationContext配置文件 中有没有加上 开启springsecurity注解,这里 小编 也是踩过一个坑 把这个配置写到了spring-security当中 ,然后我对应的注解是写在

    controller 中,问题就是出在这里 ,我的spring-security不是去管理我的controller层注解,所以把如下配置加到了applicationContext当中,我们的applicationContext 也是去注入我们 service 

    层 ,所以正好也把我们的@RolesAllowed 注解写在 applicationContext中

        <security:global-method-security
                secured-annotations="enabled"
                pre-post-annotations="enabled"
                jsr250-annotations="enabled"/>

    2.service 层 @RolesAllowed注解 给方法或者类给予权限

  • 相关阅读:
    【转】运行维护管理制度
    系统负载超预警 问题定位
    19-多进程学习
    3-Pandas层次化索引&拼接
    2-Anaconda简介&Numpy基础
    1-IPython&jupyter notebook
    18-进程&协程
    17-多线程
    16-网络通信
    15-正则表达式
  • 原文地址:https://www.cnblogs.com/KcBlog/p/14505657.html
Copyright © 2011-2022 走看看