定时任务 出现 A component required a bean named ‘xxx‘ that could not be found
定时任务 不仅出现A component required a bean named 'xxx' that could not be found 还出现了 Consider defining a bean of type 'xxx' in your configuration.
·
定时任务 不仅出现A component required a bean named ‘xxx’ that could not be found 还出现了 Consider defining a bean of type ‘xxx’ in your configuration.
如图:
这是我数据库存储定时任务的名称
在网上找了各种解决办法
有的说忘记加@Service注解,但是我已经加了
有的说需要在主启动类上加@ComponentScan注解去扫描那个类,加了,没有效果
最后发现都没有用,尝试写在数据库写限定名
结果发现还是不行!!!
最后将类名改为小写,发现可以了!!!
applicationContext.getBean 成功获取到当前类
成功运行
更多推荐
已为社区贡献3条内容
所有评论(0)