5 ms·
Cool, it is a lot to start researching but you sound like you use a very similar style to things I am used to in other languages. On guice/gwizard/maven, if I
by smorgusofborg 4y ago
Cool, it is a lot to start researching but you sound like you use a very similar style to things I am used to in other languages.
On guice/gwizard/maven, if I understand correctly I would be defining new guice DI for something like a message broker (and gwizard's solutions for similar modules might serve as a template) while probably just using direct dependencies in maven for something that doesn't need to be mocked in unit tests or replaceable in production?
- stickfigure 4y agoYou could make a new guice module for the message broker, but you don't have to. If you want to use a message broker, just bind the service object as an eager singleton in your application module. The main reason to make a separate guice module for the message broker is if setup requires a lot of boilerplate. You can put it all in a common jar artifact and include that in different services. But that's overkill if you just have one service, or if the broker has a fairly friendly interface to start with. Guice is just a little bit of structure to bind together Normal Java Code. You don't need to wrap services or do things eg "the spring way". Just use the service; if you find yourself repeating code, consider abstracting it into a separate module.