【问题标题】:Grails Spring Security annotations issueGrails Spring Security注释问题
【发布时间】:2015-12-19 03:09:12
【问题描述】:

我正在关注本教程https://grails-plugins.github.io/grails-spring-security-core/guide/tutorials.html,但@Secured注解无法解析,尽管我应用了Spring Security插件并编译。

import grails.plugin.springsecurity.annotation.Secured
class SecureController {
   @Secured('ROLE_ADMIN')
   def index() {
      render 'Secure access only'
   }
}

【问题讨论】:

  • 你的构建文件是什么样的? (3.x 的 build.gradle 或 buildconfig.groovy)
  • build.gradle 依赖项 { ... compile 'org.grails.plugins:spring-security-core:3.0.0.M1' compile "org.springframework.security:spring-security-core:4.0. 1.RELEASE”编译“org.springframework.security:spring-security-web:4.0.2.RELEASE”…}

标签: grails spring-security


【解决方案1】:

您应用了 spring-security 库,但没有应用 spring-security-core 插件。

插件的依赖如下:

plugins {
  compile ':spring-security-core:2.0-RC5'
}

【讨论】:

    猜你喜欢
    • 2014-08-22
    • 2013-05-25
    • 1970-01-01
    • 2017-04-22
    • 2012-04-10
    • 2011-03-09
    • 2011-03-05
    • 2016-07-14
    • 2017-11-06
    相关资源
    最近更新 更多