-
1. Re: CDI + Vaadin
nickarls Apr 29, 2010 8:39 AM (in response to as6o)Have a look at this article and check with the Vaadin forums.
-
2. Re: CDI + Vaadin
as6o Apr 29, 2010 3:03 PM (in response to as6o)I looked at those and used them to get started but they only show how to get the Application class annotated. They don't show annotating any other UI classes. The forums also mention has this is currently an issue with CDI and suggest accessing all context beans through the application class. I'm wondering why it has to be that way and you can't just @Inject into UI classes directly.
-Aaron
-
3. Re: CDI + Vaadin
nickarls Apr 30, 2010 8:32 AM (in response to as6o)Ask them to come over here and talk about it if they think there is some
issue with CDI
-
4. Re: CDI + Vaadin
cjalmeida May 3, 2010 4:56 PM (in response to as6o)IIRC, if you instantiate a bean using
new
keyword, it simply won't be managed, thus can't use @Inject, be intercepted, etc. When building your layout you should inject your component into the Application and then it should be managed. -
5. Re: CDI + Vaadin
rmemoria.ricardo.rmemoria.com.br May 27, 2010 11:01 PM (in response to as6o)Hi...
... I saw this post and decided to answer my experience.Since Vaadin is processed inside a Servlet, if you follow SEAM instructions to context management for custom servlets, everything will work fine:
1. Declare the seam filter in the web.xml
<filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
2. Declare your Vaadin application Servlet (as described in Vaadin book)
3. in components.xml, enable the context filter
<web:context-filter url-pattern="/vaadin-app-url/*"/>
4. Inside Vaadin servlet, use SEAM API, like Component and Contexts classes
For me it's working perfectly.
Cheers,
Ricardo -
6. Re: CDI + Vaadin
ceefour Oct 16, 2010 2:32 AM (in response to as6o)For CDI, you can also use the method described in the Vaadin wiki :
http://vaadin.com/wiki/-/wiki/Main/Creating%20JEE6%20Vaadin%20Applications
(Option 2: Use CDI)
That methods subclasses the Vaadin servlet so it's initialized by CDI using @SessionScoped, as well as getting your Vaadin application via @Inject)
I'm not sure which one is better architecturally, but that method has no dependency on Seam or any other third-party library at all.
-
7. Re: CDI + Vaadin
salvino Jun 7, 2011 3:03 AM (in response to as6o)Hi Ricardo, your solution is working for me too! Thx for the
trick
..Nevertheless, something is still missing on my side. How did you manage transactions ?
Thx in advance.
S.
-
8. Re: CDI + Vaadin
ljnelson Jun 7, 2011 8:26 AM (in response to as6o)Wouldn't Vaadin be required to have a META-INF/beans.xml in its main jar file if its artifacts were to be considered for injection? Just testing my assumptions. I am pretty sure their jar file has no such file. Apologies if this is all painfully obvious or stupid.
Best,
Laird