Inject beans from other projects into Vaadin view
In one of my Vaadin views I'm trying to get hold of a business object that
resides in another project (bll) by injecting it with @Inject.
Vaadin view:
public class FruitSaladView extends VerticalLayout implements View {
@Inject
BananaService bananaService;
...
}
I can't do this, of course, the bananaService object is null at runtime,
because I have nowhere to do a component-scan for packages.
I'm using annotations so I have no web.xml in my Vaadin web project, I
don't even have a WEB-INF folder.
I also know there are some alternatives, like the CDI-Utils and the Vaadin
CDI Vaadin addons, as well as some other solutions to this, but they all
seem to inject stuff into the Main UI (not to the views) and from the web
application itself, not from other modules.
I'm using Vaadin 7 and Tomcat 7 (as long as it's feasible using Tomcat
given the answer to the question below)
Question: What would be the recommended way to inject a bean from another
module into a Vaadin view and what do I need to do in order to accomplish
this?
Follow-up question: Will using Tomcat for this application be a problem
after using above method?
No comments:
Post a Comment