This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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: 21466
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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: 21466
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!