简体   繁体   English

在应用上下文中查找Groovy Bean

[英]Lookup Groovy Beans in App Context

I have several Groovy beans defined within my app context file, like so: 我在应用程序上下文文件中定义了几个Groovy bean,如下所示:

<lang:groovy id="bean1">
   ...
</lang:groovy>

I would like to get a list of all the groovy beans from the ApplicationContext , but don't see a clean way to do this. 我想从ApplicationContext获取所有常规Bean的列表,但是看不到一种干净的方法。

Is there a straightforward way to get a list of all the Groovy implemented beans? 有没有一种简单的方法来获取所有Groovy实现的bean的列表?

I am using Spring 3. 我正在使用Spring 3。

applicationContext.getBeansForType(Class.forName("groovy.lang.GroovyObject"));

请参阅ListableBeanFactory Javadoc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM