• Post Reply Bookmark Topic Watch Topic
  • New Topic

Run wrong Job in SpringBoot  RSS feed

 
Ranch Hand
Posts: 566
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two application where these two application are written in Spring Batch using SpringBoot
             This is one of the batch config

ReminderConfigThe intersting part is when I run /reminder, it will display ############ Start Reminder file ############, but after that it run the job inside /txn instead of /reminder job. Why would this happened ?
 
Sheriff
Posts: 21330
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you make a distinction between the two @Autowired Job fields? For your top code snippet, there is no distinction between the two methods other than the Job that's used, and I see only one defined Job in your second code snippet. To have a different job, you need to provide more than one, and use qualifiers to make a distinction between them.
 
John Joe
Ranch Hand
Posts: 566
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realized that I have defined the steps with the same name (step1) in two batches job.
This is my second job batch config
After I change step1 to another name, the job run correctly. Not sure why would this happened.
 
Rob Spoor
Sheriff
Posts: 21330
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you define a name explicitly in the @Bean annotation, it uses the method name. That means that both methods would create a bean with the same name. I would have expected an exception, but apparently one method just overwrote the results of the other.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!