當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。