title: Why reflection is used in this situation
body: <p>Today, I am looking the source code of tomcat</p>
  <p>in the <code>Bootstrap.init()</code> method, I found it used reflection to create an instance of <code>org.apache.catalina.startup.Catalina</code>, and use <code>invoke()</code> to set the <code>ClassLoader</code></p>
  <p>Like the following code</p>
  <pre class="lang-java prettyprint-override"><code>Class&lt;?&gt; startupClass = catalinaLoader.loadClass(&quot;org.apache.catalina.startup.Catalina&quot;);
  Object startupInstance = startupClass.getConstructor().newInstance();
  String methodName = &quot;setParentClassLoader&quot;;
  Method method =
              startupInstance.getClass().getMethod(methodName, paramTypes);
          method.invoke(startupInstance, paramValues);
  </code></pre>
  <p>I found that many frameworks use reflections to create an instance, even though the class and method can be determined</p>
  <p>Just like the above code, use <code>String</code> to determine the target.</p>
  <p>Is it still necessary to use reflection?</p>