82、获取容器中的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手写第二篇-IOC容器详解以及循环依赖解决


下一篇:AOP原理-AnnotationAwareAspectJAutoProxyCreator执行时机 || InstantiationAwareBeanPostProcessor