getBeanNamesForType(Class type)
引數說明:public static void main(String[] args){ ApplicationContext context = new ClassPathXmlApplicationContext( "appContext.xml"); //載入appContext.xml檔案 String[] beanNames = context.getBeanNamesForType(Date.class); //返回所有JavaBean的名稱 for(String name:beanNames){ System.out.println("JavaBean名稱:"+name); } }