Grails 3.0.2 cannot resolve @Secured annotation in controller
I am trying to upgrade my application from Grails 2.4.4 to Grails 3.0.2 and I have a problem with spring annotation.
I have a controller, for example:
import grails.plugins.springsecurity.annotation.Secured
class MyController {
@Secured(['ROLE_ADMINS_GROUP'])
def index() {
// some code
}
}
In depencencies
in a block 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 to compile my application, I get an error.
MyController.groovy: 4: unable to resolve class grails.plugins.springsecurity.annotation.Secured
@ line 4, column 1.
import grails.plugins.springsecurity.annotation.Secured
^
+3
source to share
1 answer
Spring Core Security Plugin has already been updated and is now compatible with Grails 3.0, see docs: What's New in 3.0
Just add the following dependency to the dependencies
file block build.gradle
:
compile "org.grails.plugins:spring-security-core:3.0.0.M1"
+1
source to share