在spring xml文件中使用输入对象的get方法作为constructor-arg

时间:2012-03-09 00:35:29

标签: java spring

我有这样的方法:

void testMethod(Input input) {

     TestInterface impl = new TestInterfaceImplementation(input.getName());
     SomeClass someClass = new SomeClass();
     someClass.performOperation(impl); 
} 

现在,因为我希望 performOperation (以接口作为参数)方法可以从spring配置,这意味着我必须在spring配置文件中指定 TestInterfaceImplementation 还有豆子吧?这将要求我必须以某种方式指定 TestInterfaceImplementation 的构造函数arg,从 input.getName()方法获取值。这可能吗?

请告诉我。

0 个答案:

没有答案