本文整理了Java中io.micronaut.context.ApplicationContext.findBeanDefinition()
方法的一些代码示例,展示了ApplicationContext.findBeanDefinition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext.findBeanDefinition()
方法的具体详情如下:
包路径:io.micronaut.context.ApplicationContext
类名称:ApplicationContext
方法名:findBeanDefinition
暂无
代码示例来源:origin: io.micronaut/management
/**
* @param declaringType The type
* @return An optional string with the endpoint id
*/
protected Optional<String> resolveActiveEndPointId(Class<?> declaringType) {
return endpointIds.computeIfAbsent(declaringType, aClass -> {
Optional<? extends BeanDefinition<?>> opt = beanContext.findBeanDefinition(declaringType);
if (opt.isPresent()) {
BeanDefinition<?> beanDefinition = opt.get();
if (beanDefinition.hasStereotype(Endpoint.class)) {
String id = beanDefinition.getValue(Endpoint.class, String.class).orElse(null);
if (id == null || !ENDPOINT_ID_PATTERN.matcher(id).matches()) {
id = NameUtils.hyphenate(beanDefinition.getName());
}
return Optional.ofNullable(id);
}
}
return Optional.empty();
});
}
代码示例来源:origin: io.micronaut/micronaut-management
/**
* @param declaringType The type
* @return An optional string with the endpoint id
*/
protected Optional<String> resolveActiveEndPointId(Class<?> declaringType) {
return endpointIds.computeIfAbsent(declaringType, aClass -> {
Optional<? extends BeanDefinition<?>> opt = beanContext.findBeanDefinition(declaringType);
if (opt.isPresent()) {
BeanDefinition<?> beanDefinition = opt.get();
if (beanDefinition.hasStereotype(Endpoint.class)) {
String id = beanDefinition.getValue(Endpoint.class, String.class).orElse(null);
if (id == null || !ENDPOINT_ID_PATTERN.matcher(id).matches()) {
id = NameUtils.hyphenate(beanDefinition.getName());
}
return Optional.ofNullable(id);
}
}
return Optional.empty();
});
}
内容来源于网络,如有侵权,请联系作者删除!