3

I try upgrade my application from Grails 2.4.4 to Grails 3.0.2 and I have problem with spring annotation.

I have controller, like this:

import grails.plugins.springsecurity.annotation.Secured

class MyController {  

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

In depencencies block in build.gradle I have this:

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"
}

When i try compile my application, I get error message.

MyController.groovy: 4: unable to resolve class grails.plugins.springsecurity.annotation.Secured
@ line 4, column 1.
import grails.plugins.springsecurity.annotation.Secured
^
jjaros
  • 518
  • 2
  • 4
  • 18
  • See this question please: (http://stackoverflow.com/questions/29286659/grails-3-and-spring-security-plugin). The error is happening because you're using imports from a plugin that you don't included in your dependencies and you can't do that since, as the answer above explain, the Spring Security Plugin isn't compatible with Grails 3.0. I don't know in the moment how to help you in this issue, but there are blog posts in that question that could help you, I think. – cantoni Jun 18 '15 at 15:43

1 Answers1

1

Spring Security Core Plugin has already been updated and is now compatible with Grails 3.0 see the docs: What's New in Version 3.0

Just add following dependency to the dependencies block of the build.gradle file:

compile "org.grails.plugins:spring-security-core:3.0.0.M1"
Alex
  • 8,093
  • 6
  • 49
  • 79
jan2jen
  • 33
  • 6