Guice Stories ( Part 2)

Guice Stories ( Part 2)

http://ift.tt/2qRDkao

For those of you who missed out, Part 1 of our Guice Stories series focused on Bootique and Guice’s importance to it, especially for dependency injection. Let’s continue on the journey with more Google Guice stories.

Story 3: Filling Maps and Collections

Previously, we saw the examples of adding objects to MapBinder. Let’s dwell on this for a moment. Here, I will use Multibinder for a change (remember, it produces an injectable Set<SomeType>), but the discussion applies to MapBinder just as well. What can we put in these DI-managed collections? If the objects in the Set are trivial to create and do not rely on any dependencies, we can add them as instances:

java

via DZone.com Feed https://dzone.com

May 23, 2017 at 05:27PM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s