rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Spring Batch recipe for MigrateStepBuilderFactory

Open desprez opened this issue 2 years ago • 5 comments

TEMPLATE_STOP tell me that something is missing by I don't know what

@Bean
Step myStep(JobRepository jobRepository) {
    return new StepBuilder("myStep", jobRepository)/*__TEMPLATE_STOP__*/
            ./*__TEMPLATE_STOP__*/<String, String>chunk(completionPolicy())
            .<String, String> chunk(completionPolicy())
            .reader(reader())
            .writer(writer())
            .build();
}

desprez avatar Feb 10 '23 14:02 desprez

Sorry I haven't had time to look at this yet, but I haven't forgotten

sambsnyd avatar Feb 13 '23 22:02 sambsnyd

Hello, I'm interested in this recipe as SpringBatch4To5Migration doesn't contains this migration yet. Is it pending of anything? Thanks in advance.

alexpm-14 avatar Aug 07 '23 09:08 alexpm-14

Hello, I'm interested in this recipe as SpringBatch4To5Migration doesn't contains this migration yet. Is it pending of anything? Thanks in advance.

Hi @alexpm-14 ; I'd missed this comment as I wasn't subscribed to this thread yet; I've gone ahead and made some changes to adopt rewrite 8; that hasn't yet solved the template errors reported before, but at least one of the three tests now only has type issues, no longer any template issues, so there is some progress.

As for what's needed to complete this one: I don't exactly know; I'd have to dive in more, but don't currently have the time. You're welcome to explore if you're up for it; you can fork https://github.com/desprez/rewrite-spring/tree/main and see if that get's you closer. Feel free to tag me if you make a PR there or here, and I can try to work in a review.

timtebeek avatar Sep 14 '23 16:09 timtebeek

@knutwannheden Perhaps you'd have an intuitive understanding of why we see template stop introduced here? A quick look would be appreciated if you're able to fit that in.

timtebeek avatar Sep 14 '23 16:09 timtebeek

Reworked this a bit to ensure the JobRepository is now injected as a bean method argument before we use it in the new StepBuilder. Feel like I'm close but can't work out the final step.

timtebeek avatar Feb 10 '24 21:02 timtebeek

Isolated the issue into this PR:

  • https://github.com/openrewrite/rewrite/pull/4372

timtebeek avatar Aug 02 '24 10:08 timtebeek