读书人

spring源码不理解的有关问题

发布时间: 2012-06-28 15:20:03 作者: rapoo

spring源码不理解的问题
最近闲来无事,于是阅读spring源码,读着读着碰到一个问题百思不得其解,问题在BeanUtils中的一段代码,如下:

public static <T> T instantiateClass(Class<T> clazz) throws BeanInstantiationException {Assert.notNull(clazz, "Class must not be null");if (clazz.isInterface()) {throw new BeanInstantiationException(clazz, "Specified class is an interface");}try {return instantiateClass(clazz.getDeclaredConstructor());}catch (NoSuchMethodException ex) {throw new BeanInstantiationException(clazz, "No default constructor found", ex);}}

找了所有文件,没有找到instantiateClass函数的定义;再者,这里clazz.getDeclaredConstructor(),好像Class类中没有getDeclaredConstructor()也没有这个函数啊,小弟愚钝,请高手指教。

读书人网 >开源软件

热点推荐