[英]Any server like jboss or tomcat, I want to instantiate a class from a deployed application
Is there a way that I can instantiate a Class in a deployed application by another deployed application if I know the package name and class I wan to instantiate? 有没有办法可以通过另一个已部署的应用程序在已部署的应用程序中实例化一个类,如果我知道要实例化的包名称和类? In any jboss or tomcat? 在任何jboss或tomcat?
Thanks & regards, ~K. 谢谢和问候,~K。
Yes, you can achieve that by Reflection 是的,您可以通过Reflection实现这一目标
Example 例
Bar aBar;
String barClassName = getBarImplClass();
aBar =
(Bar) Class.forName(barClassName).newInstance();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.