当前位置:网站首页>Failed to introspect class feignclientfactorybean exception troubleshooting
Failed to introspect class feignclientfactorybean exception troubleshooting
2022-07-23 20:56:00 【white_ while】
Wrong statement
BeanCreationException: Error creating bean with name 'com.xxx.XxxClient':
Lookup method resolution failed;
nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader]
The visible reason is FeignClientFactoryBean introspect Failure
introspection (Introspector) yes Java Language pairs Bean Class properties 、 A default handling method of event
Introspection is also called runtime type checking
Similar reflection , But reflection destroys Bean And introspectively follow the Convention
Code scenario
package com.xxx;
@FeignClient(value = "vxxx",contextId ="idxxx")
public interface XxxClient extends XxxFeignApi {
}
Start class scan
@EnableFeignClients(basePackages = {"com.xxx"})
Investigation thought
- see BeanDefinition Whether to create , That is, whether FeignClient class
- see FactoryBean Whether to instantiate
- see FactoryBean Of getObject Whether the method performs , That is, whether to instantiate Bean
Scan
Check the entrance run Method
run The method focuses on
this.refreshContext(context);
Commission execution
this.refresh(context);
Continue to entrust
((AbstractApplicationContext)applicationContext).refresh();
AbstractApplicationContext extends DefaultResourceLoader implements ConfigurableApplicationContext
call AbstractApplicationContext Of refresh Method
Its template method definition calls this.invokeBeanFactoryPostProcessors(beanFactory);
Here is spring The extension point
Enter during initialization PostProcessorRegistrationDelegate class
Finally, entrust ConfigurationClassPostProcessor class , Its parse Method
metadata = doProcessConfigurationClass(configClass, metadata);
perform doProcessConfigurationClass Method
It will carry out processImports Methods to import various import class
invokeBeanFactoryPostProcessors
Check the scanning class FeignClientsRegistrar
@Import(FeignClientsRegistrar.class)
public @interface EnableFeignClients {...}
adopt import Inject scan class
class FeignClientsRegistrar
implements ImportBeanDefinitionRegistrar, ResourceLoaderAware, EnvironmentAware {
// Mainly through the hook method to scan feignClient Generate BeanDefinition
// adopt ImportBeanDefinitionRegistrar Of registerBeanDefinitions Method added to BeanDefinitionRegistry
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata,
BeanDefinitionRegistry registry) {
registerDefaultConfiguration(metadata, registry);
// Add here BeanDefinition
registerFeignClients(metadata, registry);
}
}
ImportBeanDefinitionRegistrar Interface
spring The extension point , Support custom logic encapsulation BeanDefinition object ; The class that implements this interface will call back postProcessBeanDefinitionRegistry Method
Scanned feignClient It is put in when registering FactoryBean
Solution : Unify caller and callee openfeign Dependent package version
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>xxx</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>xxx</version>
</dependency>
边栏推荐
- Go to the square for dinner
- [force deduction] sum of three numbers
- Vite3 learning records
- Preprocessing tropomi (sentinel 5p) data with envi
- 【持续更新】树莓派启动与故障系列集锦
- 【云享读书会第13期】第四章 音频文件的封装格式和编码格式
- Lingo basic use
- Connect with Hunan Ca and use U_ Key login
- CDR插件开发之Addon插件002 - 用1分钟编写一个可双击运行的EXE程序
- OpenCV图像处理——拉普拉斯金字塔
猜你喜欢

Chapter 3 business function development (creating clues)

prime_series_level-1

第十二天:续第十一天(BGP相关知识)

Addon plug-in 002 of CDR plug-in development - write an EXE program that can be run by double clicking in 1 minute

第三届SLAM技术论坛-吴毅红教授

《迷失》stray工人帽子获得方法 工人安全帽在哪里?

If the order is not paid within 30 minutes, it will be automatically cancelled

高数下|二重积分的计算4|高数叔|手写笔记

Himawari-8 data introduction and download method

vite3学习记录
随机推荐
现在完全不知道怎么同步
1061 Dating
[shader realizes roundwave circular ripple effect _shader effect Chapter 6]
[continuous update] collection of raspberry pie startup and failure series
考研 | 高等数学 Chapter4 不定积分
1309_STM32F103上增加GPIO的翻转并用FreeRTOS调度测试
哈希表、无序集合、映射的原理与实现
Unity解决动画不可用:The AnimationClip ‘XXX‘ used by the Animation component ‘XXX‘ must be marked as Legacy.
HDU - 2586 How far away ?(倍增LCA)
Vite3 learning records
Himawari-8 data introduction and download method
Oom mechanism
【攻防世界WEB】难度四星12分进阶题:FlatScience
ES6 feature: Promise (custom encapsulation)
Ssm+mysql to realize snack mall system (e-commerce shopping)
Yiwen teaches you how to install MySQL
Too complete, it is recommended to collect! What can sap bring to the enterprise?
[100 cases of scratch drawing] Figure 46-scratch drawing flowers children's programming scratch programming drawing case tutorial grade examination competition drawing training case
If the order is not paid within 30 minutes, it will be automatically cancelled
Failed to introspect Class FeignClientFactoryBean 异常排查