学无先后,达者为师

网站首页 编程语言 正文

required a single bean, but 2 were found

作者:Json_Marz 更新时间: 2024-03-24 编程语言

项目集成xxljob时,报错:

Parameter 0 of method xxlJobSpringExecutor in com.wf.job.XxlJobAutoConfiguration required a single bean, but 2 were found:
	- xxlJobProperties: defined in URL [jar:file:/C:/Users/777/.m2/repository/com/xx/xx-xxl-job-spring-boot-starter/1.0.0/wf-xxl-job-spring-boot-starter-1.0.0.jar!/com/xx/job/properties/XxlJobProperties.class]
	- xx.xxl-job-com.xx.job.properties.XxlJobProperties: defined in null

因为xxljob组件是自己在xxljob的基础上封装的,然后项目启动报错,

原因是在启动类加 `@ComponentScan` 注解,配置的包扫描路径重复了,导致重新生成两个bean,而且一个bean defined in null.

解决办法就是把包扫描的路径改下,不能有包含关系。

原文链接:https://blog.csdn.net/Json_Marz/article/details/126762269

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新