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注解 给方法或者类给予权限

  • 相关阅读:
    linux read 系统调用剖析
    IO流程及优化
    分布式存储比较
    BTree,B-Tree,B+Tree,B*Tree的数据结构
    Spectrum Scale
    unixbench测试
    网络文件系统与 Linux
    协程的实现
    进程池和线程池
    django-spirt 论坛主题
  • 原文地址:https://www.cnblogs.com/KcBlog/p/14505657.html
Copyright © 2011-2022 走看看