With Spring, you can define an array property and have Spring inject one of every (@Component) class that derives from the given type.
Is there an equivalent for this in Guice? Or an extension point to add this behavior?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This looks like a use case for Guice MultiBinder. You could have something like that:
And you can inject a
Set<YourInterface>anywhere:That should match with what you need.