All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.safrain.gan.spring.groovy Maven / Gradle / Ivy

Go to download

GrooveAdmiN is a light weight debugging/management tool embedded in Java web applications.

The newest version!
package com.github.safrain.gan

import org.springframework.context.ConfigurableApplicationContext

/**
 * Spring framework support
 */
class Beans {
    ConfigurableApplicationContext context

    Object get(String name) {
        context.getBean(name)
    }

    String toString() {
        context.getBeanDefinitionNames().inject("""
Spring application context: ${context}
Beans defined in this context:
""") { r, beanName ->
            def bd = context.getBeanFactory().getBeanDefinition(beanName)
            r + "${beanName} - [${bd.getBeanClassName()}]\n"
        }
    }

    Object propertyMissing = {
        return context.getBean(it)
    }

}
beans = new Beans(context: org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(_servlet_context))





© 2015 - 2025 Weber Informatics LLC | Privacy Policy