本文整理汇总了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);
}
}