Grails 3.0.2无法解析控制器中的@Secured注释

时间:2015-06-18 14:12:03

标签: spring grails spring-security grails-3.0

我尝试将我的应用程序从Grails 2.4.4升级到Grails 3.0.2,我对spring注释有问题。

我有控制器,像这样:

import grails.plugins.springsecurity.annotation.Secured

class MyController {  

    @Secured(['ROLE_ADMINS_GROUP'])
    def index() {
        // some code
    }
}

depencencies的{​​{1}}块中我有这个:

build.gradle

当我尝试编译我的应用程序时,收到错误消息。

dependencies {
    provided 'org.springframework.boot:spring-boot-starter-logging'
    provided "org.springframework.boot:spring-boot-starter-actuator"
    provided "org.springframework.boot:spring-boot-autoconfigure"
    provided "org.springframework.boot:spring-boot-starter-tomcat"

    compile "org.springframework.boot:spring-boot-starter-security"

    provided "org.grails:grails-web-boot"
    provided "org.grails:grails-dependencies"
    provided 'javax.servlet:javax.servlet-api:3.1.0'

    testCompile "org.grails:grails-plugin-testing"

    console "org.grails:grails-console"

    compile "org.grails.plugins:wslite:0.7.2.0"
}

1 个答案:

答案 0 :(得分:1)

Spring Security Core Plugin已经更新,现在与Grails 3.0兼容,请参阅文档:What's New in Version 3.0

只需将以下依赖项添加到dependencies文件的build.gradle块:

compile "org.grails.plugins:spring-security-core:3.0.0.M1"