apache / shardingsphere-elasticjob

Distributed scheduled job
Apache License 2.0
8.12k stars 3.28k forks source link

How do elasticjob listeners inject beans in spring? #1882

Open kaihekaihe opened 3 years ago

kaihekaihe commented 3 years ago

Feature Request

For English only, other languages will not accept.

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot make decision by current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Is your feature request related to a problem?

Describe the feature you would like.

In the elasticjob 3.0.0-RC1,the listeners are instanced by spi,the beans in spring can not be injected into the listener instance. eg. @Autowired works in spring doesnot work in instance of ElasticJobLIstener

TeslaCN commented 3 years ago

Hi @kaihekaihe The listener doesn't support inject spring beans for now. Consider lazily retrieving beans by some static context holder. We're thinking about that replace SPI factory with Spring containers if the Spring dependencies present.