Spring打印当前加载的Bean
@Autowired
private ApplicationContext applicationContext;
/**
* 获取并打印Spring容器中所有的Bean名称
*/
@Test
public void beanList() {
System.out.println(Arrays.toString(applicationContext.getBeanDefinitionNames()));
}参考来源:
获取并打印Spring容器中所有的Bean名称
Print all the Spring beans that are loaded
评论已关闭