JohnTheBeloved
JohnTheBeloved

Reputation: 2433

Getting Application Configuration in doWithSpring Colsure of Plugin Descriptor

I am extending the Spring oauth Plugin and want to declare beans for some Classes I extended like the OAuthConfig class, I want to declare the extended class as a bean in the doWithSpring closure of the 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 plugin bean

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

How can I get a grails application configuration here

Upvotes: 4

Views: 1020

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

You have access to application which is the grailsApplication from doWithSpring. So you can do the following:

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

Upvotes: 4

Related Questions