public static void main(String args[]) { ApplicationContext context=new ClassPathXmlApplicationContext("classpath:spring-applicationContext.xml"); Object user= context.getBean("userController"); String[] str=context.getBeanDefinitionNames(); for (String string : str) { System.out.println("..."+string); } System.out.println("----"+user); } // REF https://blog.csdn.net/chengjunhua19890809/article/details/77981839
REF
https://blog.csdn.net/loongshawn/article/details/106259754
https://blog.csdn.net/const_/article/details/100039428