English 中文(简体)
Grails Application or Holders in Grails 6
原标题:GrailsApplication or Holders in Grails 6
  • 时间:2023-12-18 00:29:54
  •  标签:
  • grails

I m试图利用Grails 6.1.0开发申请,我需要查阅application.yml,以便在Im使用GrailsApplication时,从中检索一些会议,例如,我总是收到。 然而,当我使用<代码>Holders.config.getProperty(“环境数据......url”)

import grails.core.*

class MyService {
GrailsApplication grailsApplication

String greeting() {
    def recipient = grailsApplication.config.getProperty( foo.bar.hello )
    return "Hello ${recipient}"
}

}

问题回答

Can you confirm grailsApplication is null or grailsApplication.config is null? may Grails 6 changed the way to retrieve config.

In grails5, I am using follow static method to get config

public static String getSeedDataFolder(GrailsApplication application) {
    return application.getConfig().getProperty(SEED_DATA_FOLDER, String.class, DEFAULT_SEED_DATA_FOLDER);
}




相关问题
grails + gwt request handling via controllers

I am new to gwt. I am trying to integrate gwt+grails.Can anybody provide me a good example for handling the request using grails controllers and not a custom servlet.I will be really thankful if ...

Error loading the grails gwt module xml

I ve installed the plugin from this article by Peter http://www.cacoethes.co.uk/blog/groovyandgrails/the-command-pattern-w.... While compile time its not able to find the module file which is present ...

Sorting Objects Based on Custom Domain Class Methods

I have a domain class, in which I ve defined some methods which give the object a score based on different algorithms (eg. popularity). I now want to retrieve a list of these objects sorted by one of ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....