RaigorJiang commented on PR #2556: URL: https://github.com/apache/shardingsphere-elasticjob/pull/2556#issuecomment-6432569606
Could you please confirm and fix the following two issues in the new Spring Boot annotation examples, in both the English and Chinese documentation? ### 1. The job bean name conflicts with the bootstrap name The example uses: - Class name: `AnnotationSimpleJob` - Default Spring bean name: `annotationSimpleJob` - Configured `jobName`: `annotationSimpleJob` The scanner registers the job bean first. The new `containsBeanDefinition(jobAnnotation.jobName())` guard then finds that name already occupied and skips registering the `ScheduleJobBootstrap`. **Suggested fix:** Use a distinct `jobName`, such as `annotationSimpleJobSchedule`. ### 2. `@Component` can prevent bootstrap registration even after the names are corrected With ordinary Spring Boot component scanning, `@Component` causes the job bean to be registered before `@ElasticJobScan` runs. Spring then excludes the existing bean from the job scanner’s newly discovered candidates. As a result, the scanner does not create its bootstrap. **Suggested fix:** Omit `@Component` and let `@ElasticJobScan` register the job. If retaining `@Component` is intended, the scanner also needs to handle already registered job beans. ### Verification Both failure paths were reproduced against this PR’s head with **Spring 5.3.39 and 6.2.19**: - The job bean exists. - The `ScheduleJobBootstrap` is missing. - The job is therefore not scheduled. These issues require separate corrections: changing the name alone does not resolve the component-scanning issue. Please verify the corrected examples in a context with ordinary component scanning and confirm that the bootstrap is registered and the job is scheduled. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
