我有这样的方法:
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()方法获取值。这可能吗?
请告诉我。