Skip to content

Instantly share code, notes, and snippets.

@deigote
Last active August 29, 2015 14:01
Show Gist options
  • Save deigote/f1e7d49ca3978ec448ae to your computer and use it in GitHub Desktop.
Save deigote/f1e7d49ca3978ec448ae to your computer and use it in GitHub Desktop.
Grails - Checking which beans are available and how are they configured
def grailsApplication // Injected by default in controllers, accessible as a regular bean elsewhere
assert grailsApplication.mainContext.getBeanDefinition('sessionFactory') instanceof org.springframework.beans.factory.support.GenericBeanDefinition
// Have I any non-singleton bean ?
grailsApplication.mainContext.getBeanDefinitionNames().any {
!grailsApplication.mainContext.getBeanDefinition(it).singleton
}
@deigote
Copy link
Author

deigote commented May 6, 2014

This code can be used in a controller or service, or for example using the Console plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment