A static that uses the Holder to get the spring ApplicationContext it beans and the GrailsApplication when in those cases where its not practical or possible to inject them (such as Traits for a persitenceEntity) Obviously it highly recommended to not use this and use DI whenever possible.
Type Params | Return Type | Name and description |
---|---|---|
|
static Object |
get(String name) call the ApplicationContext.getBean |
<T> |
static T |
get(String name, Class<T> requiredType) Preferred method as typed checked, call the ApplicationContext.getBean |
|
static Config |
getConfig() @return the merged configs from application.yml, application.groovy, etc... |
|
static ApplicationContext |
getCtx() @return the spring ApplicationContext |
|
static GrailsApplication |
getGrails() @return the GrailsApplication |
call the ApplicationContext.getBean
name
- the bean namePreferred method as typed checked, call the ApplicationContext.getBean
name
- the name of the bean to retrieverequiredType
- type the bean must match. Can be an interface or superclass
of the actual class, or null
for any match. For example, if the value
is Object.class
, this method will succeed whatever the class of the
returned instance.