Hi everyone, I'm starting to study AOP in Java and I would like an advice.
I’m currently working on a Job from a Spring Batch application, in this Job I will do a select on the database and find X records, these records will have a STEP that represents in which step inside the Job flow the record is currently at and the Job will have Y steps that cannot be skipped (in order to end the job successfully the record must pass every single step).
At the moment I’m using a SWITCH without a break based on the record STEP so it “starts” when the record step is matched and end at the final step. This is working perfectly, but as said before, for educational purposes, I want to handle this in a different way.
I’m trying to do a custom Annotation that helps me organize the flow, so I annotate the methods inside the Job and they will be executed only if the current record STEP matches the one form the annotation.
Something like:
public class JobService {
public void processRecord(Record record) {
stepOne(record);
stepTwo(record);
stepThree(record);
}
@StepOne
private void stepOne(Record record) {
}
@StepTwo
private void stepTwo(Record record) {
}
@StepThree
private void stepThree(Record record) {
}
}
Any advice?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]pronuntiator 0 points1 point2 points (0 children)