Java 我们是否可以将应用程序上下文get bean类型转换为类<&燃气轮机;
在我的应用程序中,我想加载动态类。我添加了如下代码片段Java 我们是否可以将应用程序上下文get bean类型转换为类<&燃气轮机;,java,spring,Java,Spring,在我的应用程序中,我想加载动态类。我添加了如下代码片段 private static Class clazz; 在实现类的方法中 clazz = (Class) applicationContext.getBean("arrived class name for thirty party"); 在应用程序中获取类的方法有效吗 如果它的对象重新注册,并且您需要该bean的类名 clazz = applicationContext.getBean("arrived class name for
private static Class clazz;
在实现类的方法中
clazz = (Class) applicationContext.getBean("arrived class name for thirty party");
在应用程序中获取类的方法有效吗 如果它的对象重新注册,并且您需要该bean的类名
clazz = applicationContext.getBean("arrived class name for thirty party").getClass();
如果它的字符串值注册为bean,并且您需要它的类实例
clazz = Class.forName(applicationContext.getBean("arrived class name for thirty party"));
如果它的对象重新注册,您需要该bean的类名
clazz = applicationContext.getBean("arrived class name for thirty party").getClass();
如果它的字符串值注册为bean,并且您需要它的类实例
clazz = Class.forName(applicationContext.getBean("arrived class name for thirty party"));
您可以使用-clazz=applicationContext.getBean(“三十方到达的类名,.class”)
ex-Employee emp=ctx.getBean(“三十方的到达类名”,Employee.class) 您可以使用-clazz=applicationContext.getBean(“三十方到达的类名,.class”) ex-Employee emp=ctx.getBean(“三十方的到达类名”,Employee.class)