first defines a condition, and the condition is true by default, as shown in figure:

then @ Conditional on the Service implementation class added to the annotations, as shown in figure is the Service interface and implementation classes:


the last test class, call the implementation class insert method:

running results show that the Condition class is called the three times, this is why

could you please tell me when the three are called?
CodePudding user response:
If you can, can also provide the debugging method, now don't know how to debug, annotations should I doubt is whether conditions established (@ Conditional) up once, judge success after instantiation Impl injection in the time of the spring container (@ Service) verified once again, and then call the (@autowired) verified once again,,, knowledge guess, don't know how to verify, beg god forCodePudding user response:
If you can, can also provide the debugging method, now don't know how to debug, annotations should I doubt is whether conditions established (@ Conditional) up once, judge success after instantiation Impl injection in the time of the spring container (@ Service) verified once again, and then call the (@autowired) verified once again,,, just wondering, don't know how to verify, beg god forCodePudding user response:
I also encountered this problem, now know why?