Getting application configuration in doWithSpring Colsure plugin descriptor

I am extending the Spring oauth plugin and want to declare beans for some classes that I have extended, like the OAuthConfig class , I want to declare the extended class as a bean in closing the doWithSpring plugin descriptor

public class MyOAuthConfig extends org.scribe.model.OAuthConfig {


   public MyOAuthConfig(String key, String secret) {
    super(key, secret); 
   }

}

I want to declare this class as a bean plugin

doWithSpring{
   passportOAuthConfig(com.mycompany.security.MyOAuthConfig){
        key = [application configuration here]
   }
}

How can I get grails application configuration here

+4
source share
1 answer

You have access to applicationwhich is grailsApplicationfrom doWithSpring. So you can do the following:

doWithSpring = {
  ...
   passportOAuthConfig(com.mycompany.security.MyOAuthConfig){
        key = application.config.someValueFromHere
   }
  ...
}
+4
source

All Articles