【问题标题】:Getting Application Configuration in doWithSpring Colsure of Plugin Descriptor在插件描述符的doWithSpring Colsure中获取应用程序配置
【发布时间】:2015-05-16 15:37:03
【问题描述】:

我正在扩展 Spring oauth 插件并想为我扩展的一些类声明 bean,例如 OAuthConfig 类,我想在 doWithSpring 闭包中将扩展类声明为 bean插件描述符

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


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

}

我想将这个类声明为插件 bean

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

如何在此处获取 grails 应用程序配置

【问题讨论】:

    标签: grails oauth spring-security grails-plugin


    【解决方案1】:

    您可以访问application,这是来自doWithSpringgrailsApplication。因此,您可以执行以下操作:

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

    【讨论】:

      猜你喜欢
      • 2015-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-04
      • 2010-10-28
      • 2011-03-29
      相关资源
      最近更新 更多