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

  • 相关阅读:
    163国内镜像源
    一个简单的springboot项目
    springcloud概述
    final关键字
    springboot项目多模块打包
    Unity Shaderlab: Object Outlines
    生命周期
    Unity内置事件
    Win10输入指示器关掉后自动恢复的问题
    Unity Shader-后处理:景深
  • 原文地址:https://www.cnblogs.com/KcBlog/p/14505657.html
Copyright © 2011-2022 走看看