Last active
August 29, 2015 14:01
-
-
Save deigote/f1e7d49ca3978ec448ae to your computer and use it in GitHub Desktop.
Grails - Checking which beans are available and how are they configured
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code can be used in a controller or service, or for example using the Console plugin.