调用
MethoddeclaredMethod = bean.getClass().getDeclaredMethod(
"set" + propertyValue.getName().substring(0, 1).toUpperCase()
+ propertyValue.getName().substring(1), value.getClass());
抛出异常
java.lang.NoSuchMethodException: us.codecraft.tinyioc.HelloWorldServiceImpl.setOutputService(us.codecraft.tinyioc.OutputServiceImpl)
但是HelloWorldServiceImpl有这个set方法
packageus.codecraft.tinyioc;
/** * @author yihua.huang@dianping.com */publicclassHelloWorldServiceImplimplementsHelloWorldService {
privateStringtext;
privateOutputServiceoutputService;
@OverridepublicvoidhelloWorld() {
outputService.output(text);
}
publicvoidsetText(Stringtext) {
this.text = text;
}
publicvoidsetOutputService(OutputServiceoutputService) {
this.outputService = outputService;
}
publicOutputServicegetOutputService() {
returnoutputService;
}
}
调用
抛出异常
但是
HelloWorldServiceImpl有这个set方法