Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Run wrong Job in SpringBoot  RSS feed

 
Ranch Hand
Posts: 570
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: 21453
96
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: 570
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: 21453
96
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!