//获取springboot所有加载的bean @Bean public CommandLineRunner commandLineRunner(ApplicationContext ctx) { return args -> { System.out.println("Let's inspect the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); } }; }
spring boot获取容器所有初始化的bean
最新推荐文章于 2024-08-07 18:08:32 发布