Grails Upgrade from 2.2.1 to 2.3.4 @Secured Annotation

grails, groovy, spring-security

Solution

I believe you need to change that to

    @Secured(['IS_AUTHENTICATED_FULLY', 'ROLE_SHOW'])
    def history() {
        def instanceList = super.history(Perm.get(params.id))
        [instanceList: impInstanceList]
    }

I.e. change it to a method from a closure definition

Problem

I just upgraded my grails application from 2.2.1 to 2.3.4 with mostly success and upgraded spring security plugin from 1.2.7.3 to 2.0-RC2. However, I'm getting an error regarding the spring security plugin (spring-security-core:2.0-RC2). ``` Annotation @grails.plugin.springsecurity.annotation.Secured is not allowed on element FIELD ``` I thought it might have something to do with the new restriction of only being able to annotate methods instead of actions but I am annotating the method not an action... so... Here's annotated controller (although the message appears for all annotations): ``` @Secured(['IS_AUTHENTICATED_FULLY', 'ROLE_SHOW']) def history = { def instanceList = super.history(Perm.get(params.id)) [instanceList: impInstanceList] } ```

Original source