本文整理匯總了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());
}
}
}
}
}
示例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);
}
};
}
示例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);
}
}
}
示例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);
}
};
}
示例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("---");
};
}
示例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);
}
}
示例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);
}
};
}
示例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);
}
}
}
}
示例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);
}
}