我试图在Spring XD中创建一个用于执行Hadoop拷贝的util类,我将配置定义如下
<int:channel id="input"/>
<int:service-activator input-channel="input" ref="utilhandler" />
<bean id="utilhandler" class="com.test.hadoop.HadoopUtil"/>
<hdp:configuration register-url-handler="false" properties-location="${xd.config.home}/hadoop.properties" >
fs.defaultFS=${fsUri}
</hdp:configuration>
</beans>
下面的是snippet bean类 import org.apache.hadoop.conf.Configuration; 公共类HadoopUtil实现InitializingBean {
private String destinationDir;
private FsShell shell;
@Autowired
private Configuration configuration;
public Configuration getHadoopConfiguration()
{
return configuration;
}
当我执行时,我正处于异常
之下Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.config.ServiceActivatorFactor
yBean#0': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Found ambiguous parameter type [class java.lan
g.Void] for method match: [public org.apache.hadoop.conf.Configuration com.test.hadoop.HadoopUtil.getHadoopConfiguration(), public void com.test.hadoop.HadoopUtil.setConfiguration(org.apache.hadoop.conf.Configuration)]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
请帮忙
答案 0 :(得分:0)
您必须为属性configuration
定义setter和getter方法
请用此测试,让我们知道它有效或需要更多帮助