在我的代码中,我有一个HPContentModule:
@Resource(name = "HPContentModule")
private HPContentModule hpContentModule;
我想知道是否有可能获得一个字符串,使其满足以下条件:
String
。String myString = "hpContentModule";
那么我可以使用myString
调用hpContentModule
,像这样执行myString.init();
,其中init()
是HPContentMethod
中的一个方法吗?
或者,
如果我有这个bean:
<beans:bean id="myBean" class="com.app.search.HPContent" />
在控制器中,我可以通过String
调用这个bean吗?
<constructor-arg ref="..." />
值。我的意思是,您可以加载一个资源文件,该文件提供您要加载的bean的名称(例如,<constructor-arg ref="${hpContentModuleName}" />
)。 - pickypg