I want to define injection so that only if the injected interface has EJB it will be injected. This is used as a plug-in to the main EJB. How to do this? Is there some annotation for this?
I can use @PostConstruct to manually "inject" the variable. But then I have to handle the dependencies by myself. How can I handle dependencies knowing that one of them is optional? How do I handle the order of deployment of different dependent modules.
Update:
I see that google has an inject annotation with optional parameter:
import com.google.inject.Inject;
@Inject(optional = true)
Update 2: JBoss has something that may be what I'm looking for:
import org.jboss.annotation.IgnoreDependency;
@IgnoreDependency @EJB OtherBean otherBean;
The solution would be to use JNDI and not injection in this particular case. That way I have full control over the dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With