Setcollection into a target bean.
SuperHeroimplementations marked as Petite beans:
SuperHeroimplementations, but at this moment we are not yet sure how many.
Setfield that has generics type of beans that has to be injected:
GothamCityfrom container, the field
superHeroeswill contain an
Setinstance. Set will contain all
Petitebeans that are of type
SuperHero. Easy as that!
HashSetcan be used as field type.
Listwith no defined beans order).
EmailPaymentEvent. This one knows how to send an e-mail that contains all payment data to the user.
PaymentService- business class that actually performs the payment and that should call the event after successful payment.
PaymentEventcode to support executors thread pool - but, to be hones, that is not the right place for that. Event doesn't have to be aware of the way how it is invoked.
PaymentEventDispatcheris also a
PaymentEvent- since it is a dispatcher and façade, it make sense. But wait, since
PaymentEventDispatcheris also part of the Petite context, wouldn\'t it be also inside the injected set? Good thinking, but no - Petite is smart, so it will not put target injection instance in the set.