-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APPLICATION FAILED TO START ”A component required a bean named '***' that could not be found.“ #2014
Comments
@prefect1005 you can put @lazy annotation on Controller to make sure the application is running normally
|
You can also use @Autowried(required=false) @qualifier("myOneOffJobBean") |
I also have the same problem |
#1930 this fix is the cause of this issue, i think the only solution is lazy init, but OneOffBootStrap is final. #1810 if we need to autowire OneOffBootStrap, OneOffBootStrap need to be registered before AutowiredAnnotationBeanPostProcessor, so ElasticJobProperties bean need to be initialized before AutowiredAnnotationBeanPostProcessor, which means ElasticJobProperties will be not eligible for getting processed by all BeanPostProcessors. |
|
another way is to use @lookup, is this okay? @linghengqian
|
|
|
Bug Report
Which version of ElasticJob did you use?
elasticjob-lite-spring-boot-starter 3.0.1
Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
ElasticJob-Lite
Actual behavior
APPLICATION FAILED TO START
Description:
A component required a bean named 'myOneOffJobBean' that could not be found.
my config:
elasticjob.jobs.oneOffJob.elasticJobClass=com.example.demo.MyElasticJob
elasticjob.jobs.oneOffJob.jobBootstrapBeanName=myOneOffJobBean
elasticjob.jobs.oneOffJob.shardingTotalCount=3
in controller:
@resource(name = "myOneOffJobBean")
private OneOffJobBootstrap myOneOffJobBean;
Reason analyze (If you can)
in 3.0.0 version is ok
i find
#1810
this issues
and in this merge
0446a5d
JobBootstrapBeans instantiation in afterSingletonsInstantiated
just because of this,in application Controller , the OneOffJobBootstrap has not init.
so what can i do?
hope to reply, thanks
Steps to reproduce the behavior.
Example codes for reproduce this issue (such as a github link).
The text was updated successfully, but these errors were encountered: