当前位置:网站首页>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>
边栏推荐
- 模块化开发
- TROPOMI(哨兵5P)数据介绍及下载方法
- Read the five flow indicators of R & D efficiency insight
- MySQL(3)
- Understanding of signals
- 网络学习型红外模块,8路发射独立控制
- Himawari-8 data introduction and download method
- OpenIM重大升级-群聊读扩散模型发布 群管理功能升级
- If the order is not paid within 30 minutes, it will be automatically cancelled
- 深入浅出边缘云 | 1. 概述
猜你喜欢

Tropomi (sentinel 5p) data introduction and download method

深入浅出边缘云 | 1. 概述

Jetson nano烧录踩坑记(一定可以解决你的问题)

05_ue4进阶_材质UV缩放

做一个有职业操守的软件匠人

Junior intern, ByteDance, after sharing, has been offered

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

Network learning infrared module, 8-way emission independent control

Vite3 learning records

Read the five flow indicators of R & D efficiency insight
随机推荐
Today's sleep quality record 81 points
1063 Set Similarity
[cloud co creation] what magical features have you encountered when writing SQL every day?
Jetson nano recording stepping on the pit (it will definitely solve your problem)
当我们在谈论陈春花和华为时,我们到底在讨论什么?
Tropomi (sentinel 5p) data introduction and download method
【微信小程序】你了解小程序开发吗?
高数下|三重积分的计算1|高数叔|手写笔记
MySQL(3)
微服务架构 VS 单体服务架构【华为云服务在微服务模式里可以做什么】
prime_series_level-1
利用ENVI对TROPOMI(哨兵5P)数据预处理
Day 11: continue the basic configuration of BGP for day 10
【LeetCode】Day101-旋转图像
【着色器实现RoundWave圆形波纹效果_Shader效果第六篇】
Jetson nano烧录踩坑记(一定可以解决你的问题)
Preprocessing tropomi (sentinel 5p) data with envi
[100 cases of scratch drawing] Figure 46-scratch drawing flowers children's programming scratch programming drawing case tutorial grade examination competition drawing training case
OpenLayers实例-Accessible Map-可访问的地图
第十一天:续第十天BGP的基本配置