Does anyone know the difference between creating an object using the new keyword and Beans.instantiate() as shown below? modelManager = (ModelManager) Beans.instantiate(this.getClass().getClassLoader(), "com.sun.j2ee.blueprints.petstore.control.web.ModelManager"); (Code taken from the PetStore MainServlet.java). Thanks, Francois
To me the biggest difference is when you use instantiate(), you don't have to know the Class name of the object at development time. The class that you want an instance of can be determined at runtime from a String. Matt