So, I was able to fix my problem, here is what I've done :
Maven dependencies
I was assuming that javax:javaee-api
was enough to use the functionnalities of Java EE 7. I've added dependencies to javax.enterprise:cdi-api
, javax.inject:javax.inject
and javax.annotation:javax.annotation-api
beans.xml
It's only one big project build into a war archive. I've put my beans.xml under src/main/webapp/WEB-INF
(Is it necessary to have it at all with Wildfly ? Don't know)
Vaadin CDIUI
That's what solved my issue. I've tried to use Vaadin CDIUI without success. Vaadin was actually initializing my UI class with a new
operation. Since it was not managed by the container, every Injection points didn't work (I've first fix it by doing new
operations on my views and controllers, falling on the problem I've described)
I've refactored everything so injection is used in the views and controllers, and I've added @CDIUI
to my Vaadin UI. Last, I've also added a new parameter to my servlet configuration (UIProvider
) for this result :
@Theme("chameleon-green")
@Title("Data Manager")
@CDIUI("")
public class DataManagerUI extends UI {
@WebServlet(value = "/*",
asyncSupported = true,
initParams = {@WebInitParam(
name = "session-timeout",
value = "60"
),@WebInitParam(
name = "UIProvider",
value = "com.vaadin.cdi.CDIUIProvider"
)}
)
@VaadinServletConfiguration(productionMode = false,
ui = DataManagerUI.class,
closeIdleSessions = true
)
public static class Servlet extends VaadinServlet {
}
[...]
}
When normally instantiated with new
operation from Vaadin framework, the UI class should be given by the UIProvider
when using Injection.
Thanks for the help !