当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationContext.getBeanDefinitionNames方法代码示例

本文整理汇总了Java中org.springframework.context.ApplicationContext.getBeanDefinitionNames方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationContext.getBeanDefinitionNames方法的具体用法?Java ApplicationContext.getBeanDefinitionNames怎么用?Java ApplicationContext.getBeanDefinitionNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.context.ApplicationContext的用法示例。


在下文中一共展示了ApplicationContext.getBeanDefinitionNames方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commandLineRunner

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Profile("trace")
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:17,代码来源:CalendarClientApplication.java

示例2: setApplicationContext

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    //Map<String, Object> serviceMap = applicationContext.getBeansWithAnnotation(XxlWebHandlerMapping.class);

    String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
    if (beanDefinitionNames!=null && beanDefinitionNames.length>0) {
        for (String beanDefinitionName : beanDefinitionNames) {

            boolean isApiHandler = applicationContext.isTypeMatch(beanDefinitionName, XxlWebHandler.class);
            if (isApiHandler) { // if (beanDefinition instanceof XxlWebHandler) {
                Object beanDefinition = applicationContext.getBean(beanDefinitionName);
                // valid annotation
                XxlWebHandlerMapping annotation = beanDefinition.getClass().getAnnotation(XxlWebHandlerMapping.class);
                if (annotation!=null && annotation.value()!=null && annotation.value().trim().length()>0 ) {
                    handlerRepository.put(annotation.value(), (XxlWebHandler) beanDefinition);
                    logger.warn(">>>>>>>>>>> xxl-hex, bind hex handler success : {}", annotation.value());
                }
            }

        }
    }

}
 
开发者ID:xuxueli,项目名称:xxl-web,代码行数:25,代码来源:XxlWebHandlerFactory.java

示例3: commandLineRunner

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println(
                "***************************************************** \n" +
                        "HERE ARE THE BEANS \n" +
                        "*****************************************************"
        );

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

    };
}
 
开发者ID:boweihan,项目名称:basic-spring-boot-server,代码行数:19,代码来源:Application.java

示例4: main

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ApplicationContext application = SpringApplication.run(ApplicationMain.class, args);
    if (logger.isDebugEnabled()) {
        String[] beanDefinitionNames = application.getBeanDefinitionNames();
        for (String beanName : beanDefinitionNames) {
            logger.debug(beanName);
        }
    }
}
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:10,代码来源:ApplicationMain.java

示例5: commandLineRunner

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
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);
        }

    };
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:14,代码来源:CalendarApplication.java

示例6: commandLineRunner

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:16,代码来源:CalendarApplication.java

示例7: main

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	ApplicationContext applicationContext = 
			SpringApplication.run(SpringbootIn10StepsApplication.class, args);
	
	for (String name : applicationContext.getBeanDefinitionNames()) {
		System.out.println(name);
	}
}
 
开发者ID:in28minutes,项目名称:spring-web-services,代码行数:9,代码来源:SpringbootIn10StepsApplication.java

示例8: commandLineRunner

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@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) {
            LOGGER.debug(beanName);
        }
    };
}
 
开发者ID:junneyang,项目名称:xxproject,代码行数:14,代码来源:Application.java

示例9: findAndRegisterAnnotatedDelegates

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
private void findAndRegisterAnnotatedDelegates(
        ApplicationContext applicationContext) {
    String[] beanNames = applicationContext.getBeanDefinitionNames();
    for (String beanName : beanNames) {
        Object bean = applicationContext.getBean(beanName);
        if (bean != null) {
            Class<?> type = bean.getClass();
            Method[] methods = type.getMethods();
            for (Method method : methods) {
                findAndRegisterAnnotatedDelegateMethods(bean, method);
            }
        }
    }
}
 
开发者ID:Esri,项目名称:server-extension-java,代码行数:15,代码来源:RestDelegateMappingRegistry.java

示例10: main

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
	ApplicationContext ctx = SpringApplication.run(Application.class, args);
	String[] beanNames = ctx.getBeanDefinitionNames();
	Arrays.sort(beanNames);
	for (String beanName : beanNames) {
		System.out.println(beanName);
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Spring-5.0,代码行数:9,代码来源:Application.java


注:本文中的org.springframework.context.ApplicationContext.getBeanDefinitionNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。