I used grails 3.1.X in NetBeans 8.1. Secured plugin is not resolving wen a used annotation. Code below:
package securityplugintest
//import grails.plugins.springsecurity.Secured
import grails.plugin.springsecurity.annotation.Secured //not esolved
@Secured(['ROLE_USER']) //not resolved
class ProductAnnouncementController {
def index() {
def announcements = ProductAnnouncement.createCriteria().list {
order("dateCreated", "desc")
maxResults(1)
}
render announcements.first()?.message
//render announcements.any()?.meassage
}
}
In NetBeans I have configured Grails 3.1.11, and spring-security plugin as
dependencies {
compile 'org.grails.plugins:spring-security-core:3.0.3'
}
I am following this manual and getting error for the last step.
Well First thing you should add plugin
compile 'org.grails.plugins:spring-security-core:3.1.1under thebuild.gradle. I have just given you the different plugin version than that of you are using nothing more.Second thing you should compile your project after adding the plugin.
This should do the trick for you.
But as you have stated that you are getting the
red lineunder theimport grails.plugin.springsecurity.annotation.Securedafter above steps.Please follow the below step :
As stated in the
Grails 3docs ->In your case please try to specify it.
And before running the app please clean -> compile -> run your app.