简体   繁体   English

任何服务器,如jboss或tomcat,我想从已部署的应用程序实例化一个类

[英]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.

相关问题 我可以在诸如tomcat或jboss之类的应用服务器中运行vert.x实例吗 - Can i run a vert.x instance inside an application server like tomcat or jboss 如何计划从 WebSphere 迁移到更便宜的应用程序服务器,如 JBoss、Tomcat 或 Payara - How to plan the migration from WebSphere to a cheaper application server like JBoss, Tomcat or Payara JBoss Application Server:从另一台机器访问已部署的Web应用程序 - JBoss Application Server: Accessing deployed web application from another machine 是否有任何方法可以将文件添加到tomcat服务器上已部署的Web应用程序 - IS there any way to add files to a deployed web application on tomcat server Spring 引导:如何获取部署在 JBoss(或任何应用服务器)上的应用程序的运行端口? - Spring Boot: How to get running port of application deployed on JBoss (or any app server)? 用于Java EE应用程序的Tomcat或JBoss服务器? - Tomcat or JBoss server for a Java EE application? 如何在tomcat服务器中获取所有已部署的应用程序 - How to get all deployed application in tomcat server 使用tomcat服务器编辑已部署的应用程序 - Edit a deployed application using tomcat server 如何将已部署的应用程序从应用程序服务器更改为Web服务器? - How can i change deployed application to webserver from application server? 我是否可以仅使用应用程序服务器(Tomcat,JBoss等)创建Java Portal(JSR 168/286)? - Can I create a Java Portal (JSR 168/286) using only an application server (Tomcat, JBoss, etc)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM