Yes, it will work fine. In fact the author of guice (Bob Lee) is a spec-lead for the javax.inject
specification.
javax.inject.Inject
does not have the optional
attribute, so if you want an optional dependency, you’d have to use the guice annotation.