1.去掉相关类 如RestClientSupport

2.引入依赖(通过bns,去查已有相关依赖的其他项目。jar包的pom.xml中有版本号)

Caused by: java.lang.ClassNotFoundException: com.xxxxsuperhero.util.bns.BnsClient
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 51 common frames omitted

总是提示无法注入Service或者Dao中的Bean。SpringBoot项目的Bean装配默认规则是根据Application类所在的包位置从上往下扫描!
“Application类”是指SpringBoot项目入口类。这个类的位置很关键:如果Application类所在的包为:com.demo.module,则只会扫描com.demo.module包及其所有子包,如果service或dao所在包不在com.demo.module及其子包下,则不会被扫描!所以需在application启动类中加上@MapperScan("com.*.dao")//加上你项目的dao或service所在文件位置即可
@SpringBootApplication

由于我的代码框架不是Springboot,使用bean的注解,就报错,需要两步

1. 接口上加注解:

@SpringBootApplication

2.application启动类中加上

@MapperScan("com.*.dao")//加上你项目的dao或service所在文件位置即可 @SpringBootApplication

eg

@MapperScan("com.*.sercice")//加上你项目的dao或service所在文件位置即可
@SpringBootApplication(scanBasePackages = {"com.*.sercice"})

3.注意实现类上要有注解 Service or Component

2.服务加上注解

@Component或者@Service

ps:

@Component spring基础的注解,被spring管理的组件或bean

@Repository 用于持久层,数据库访问层

@Service 用于服务层,处理业务逻辑

@Controller 用于呈现层,(spring-mvc)

2022-11-07 14:46:49.446 ERROR [main] o.s.boot.SpringApplication.reportFailure(837) : [logid:, spanId:] Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logPresentController': Unsatisfied dependency expressed through field 'logProcessorService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'LogProcessorService': Unsatisfied dependency expressed through field 'logProcessorClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logProcessorClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [xxxxxxxxImpl] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at com.dxxxxxxxxxxxxx.ServerApplication.main(ServerApplication.java:22)


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LogProcessorClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.xxxxxxxxxxxxxLogProcessorClientImpl] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]

ava.lang.IllegalStateException: Failed to introspect Class [xxxxxxxxImpl] from ClassLoader-Autowired相关推荐

  1. 异常解决:java.lang.IllegalStateException: Failed to introspect Class

    java.lang.IllegalStateException: Failed to introspect Class 异常详情 原因 解决办法 异常详情 Exception encountered ...

  2. IDEA| java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context

    问题:java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.pr ...

  3. Caused by: java.lang.IllegalStateException: Failed to introspect Class

    Spring-Data-ElasticSearch整合spring boot问题 Caused by: java.lang.IllegalStateException: Failed to intro ...

  4. eureka client无法启动,java.lang.IllegalStateException: Failed to introspect Class

    报错异常: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.netflix ...

  5. java.lang.IllegalStateException: Failed to introspect Class

    异常内容 [org.springframework.web.context.support.XmlWebApplicationContext][Exception encountered during ...

  6. 【spring_Cloud】java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud

    java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.netflix.eurek ...

  7. Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mchange.v2.c3p0.ComboPoo

    主要问题:Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.mchange.v2.c3p0.Com ...

  8. java.lang.IllegalStateException: Failed to introspect Class报错原因和解决办法

    这个报错其实就是没有找到要加载的类,一般在启动的时候报错. 加载不到的类有两种情况,一种是直接找不到要加载的依赖包,或者添加了依赖包后没有加载进入,需要看看是不是 maven 的设置问题,重新刷新加载 ...

  9. Failed to introspect Class [XXX] from ClassLoader

    出差到客户现场,部署环境.结果之前好好程序到了这边就突然无法启动,报错如下 2019-06-26 11:37:47 [main] WARN  [org.springframework.boot.web ...

最新文章

  1. 33个神经网络「炼丹」技巧
  2. 【编程好习惯】青睐小粒度锁
  3. 【正一专栏】欧洲五大联赛猜想(二)西甲冠绝欧洲英超继续混战
  4. 设置ALV单元格可编辑状态
  5. EntityFramework走马观花之CRUD(上)
  6. 【华为云技术分享】如何使用pyCharm与ModelArts公有云服务联动开发,快速且充分地利用云端GPU计算资源
  7. (转)Spring4.2.5+Hibernate4.3.11组合开发
  8. logistics模型的训练
  9. Jquery封装幻灯片效果
  10. centos7.3二进制安装mariadb10.2.8
  11. 《实战 Java 高并发程序设计》笔记——第1章 走入并行世界(一)
  12. javaScript中什么时候用分号;
  13. 韩寒:给李彦宏先生的一封信
  14. ECSHOP全部品牌页实现分页换页功能方法
  15. 通过一道ARM PWN题引发的思考:jarvisOJ_typo
  16. codeblocks改变主题背景颜色
  17. 矩阵(一):SVD分解
  18. 客户/供应商主数据批导
  19. UMLChina建模竞赛第3赛季第4轮:“答题抽奖”建模
  20. android+计划管理软件,安卓日程管理软件哪个好?

热门文章

  1. Python基础操作(2)
  2. 极路由 mysql_用极路由3和移动硬盘DIY时间胶囊TimeCapsule做备份
  3. 直播设备之技术分享:全NDI 和NDI |HX
  4. RMAN备份数据库_为长期存储做数据库备份(归档备份,Archival Backup)
  5. 【vue】vue用了keep-alive生命周期只执行一次怎么办?
  6. 直销银行和网上银行区别
  7. dom4j解析xml报错
  8. 代码审计--17--修复方案汇总(上)
  9. d3.js 旋转图形_视觉效果和动态图形软件After Effects 2019 v16.1.3.5 Win/Mac 中文/英文/多语言破解版...
  10. Excel 查重小技巧,适用于office2003