Java 为什么Tomcat使用反射进行Catalina实例化

Java 为什么Tomcat使用反射进行Catalina实例化,java,tomcat,reflection,Java,Tomcat,Reflection,阅读Tomcat 7源代码,我只是想知道为什么Tomcat实例Catalina并通过使用反射调用相关方法,而不是简单地使用new来创建对象并直接调用方法?答案在Bootstrap类的javadoc注释中: /** * Bootstrap loader for Catalina. This application constructs a class loader * for use in loading the Catalina internal classes (by accumulat

阅读Tomcat 7源代码,我只是想知道为什么Tomcat实例Catalina并通过使用反射调用相关方法,而不是简单地使用
new
来创建对象并直接调用方法?

答案在
Bootstrap
类的javadoc注释中:

/**
 * Bootstrap loader for Catalina.  This application constructs a class loader
 * for use in loading the Catalina internal classes (by accumulating all of the
 * JAR files found in the "server" directory under "catalina.home"), and
 * starts the regular execution of the container.  The purpose of this
 * roundabout approach is to keep the Catalina internal classes (and any
 * other classes they depend on, such as an XML parser) out of the system
 * class path and therefore not visible to application level classes.
 *
 * @author Craig R. McClanahan
 * @author Remy Maucherat
 * @version $Id: Bootstrap.java 1142323 2011-07-02 21:57:12Z markt $
 */

public final class Bootstrap { ... }

你能把我们链接到相关的源代码吗?在不相关的新闻中:我真的很喜欢“instancilization”这个词,并会尝试将它作为我的活动词汇表的一部分。请看:Class startupClass=catalinaLoader.loadClass(“org.apache.catalina.startup.catalina”);对象startupInstance=startupClass.newInstance();