I'm still new with EJB and i have an injection issue.
I'am using the @Stateless
annotation to create stateless beans. And I inject this beans by using the @EJB
annotation. All works fine!
Then I did a new project setup. I have a common ejb project, which contains common logic. This common ejb project contains interfaces which are used to call specific logic of projects, which use this common ejb project. Still, everything works fine.
But: If a project, which uses the common ejb project, does not implement all interfaces, I receive an Exception
on startup, that no implementation can be found for this interface and so nothing can be injected. Which is right, because there is no implementation.
But I want that in this case, the interface is just null
. The reason is, that not all projects which use the common ejb project, want to use all of the common logic and so they don't have to implement all interfaces.
Of course i could do dummy interface-implementations but it would be nicer if there is something like in spring @Autowired(required=false)
Any idea to solve this issue?