-
15. Re: Someone got @Named producer injection to work?
meetoblivion Dec 27, 2009 10:40 PM (in response to johaneltes)the code i posted is based on the Logger extension. Logger works today. (@Inject @Log Logger log, or something like that; it's based on SLF4J)
take a look here:
http://anonsvn.jboss.org/repos/weld/extensions/trunk/core/ and
http://docs.jboss.org/weld/reference/1.0.0/en-US/html/extensions.htmlassuming that you build against this as well as the core, it should work, but i'm not sure what the compatibility is if you move from weld to another CDI (e.g. CanDI) provider.
-
16. Re: Someone got @Named producer injection to work?
gavin.king Dec 27, 2009 11:32 PM (in response to johaneltes)
...This would be immensely cool. Is this a feature of CDI today, or a vision for a forthcoming version?This is a standard feature of CDI, defined in spec section 5.5.7. Check out the documentation.
-
17. Re: Someone got @Named producer injection to work?
meetoblivion Dec 28, 2009 12:23 AM (in response to johaneltes)
Gavin King wrote on Dec 27, 2009 23:32:
Check out the documentation.a note about that documentation, ip.getAnnotation(Annotation) doesn't exist. no such method. :-(
-
18. Re: Someone got @Named producer injection to work?
gavin.king Dec 28, 2009 12:43 AM (in response to johaneltes)Yes, I already fixed that in the docs. You need to call getAnnotated().getAnnotation(...).
-
19. Re: Someone got @Named producer injection to work?
johaneltes Dec 28, 2009 1:07 AM (in response to johaneltes)I got i working, but I had to include the @Inject annotation. Without it, the producer wasn't triggered. This worked: private @Inject @JmsTemplateType(timeout=100) JmsTemplate errorQeueTemplate; This didn't: private @JmsTemplateType(timeout=100) JmsTemplate errorQeueTemplate; Here's the annotation type: @Qualifier @Target({METHOD, FIELD, PARAMETER, TYPE}) @Retention(RUNTIME) public @interface JmsTemplateType { @Nonbinding int timeout() default 30; }
-
20. Re: Someone got @Named producer injection to work?
gavin.king Dec 28, 2009 1:12 AM (in response to johaneltes)yes, you need the @Inject annotation
-
21. Re: Someone got @Named producer injection to work?
meetoblivion Dec 28, 2009 1:14 AM (in response to johaneltes)you can blame spring/google for that one :-) everything needs @Inject at the Injection point.
i'm curious, simply because we have JMS needs as well, what spring jars did you have to include to get this to work?
-
22. Re: Someone got @Named producer injection to work?
johaneltes Dec 28, 2009 8:08 AM (in response to johaneltes)Declared Maven deps:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId> <version>2.5.6</version> </dependency> Resolved libs: NFO] | \- org.springframework:spring-jms:jar:2.5.6:compile [INFO] | +- org.springframework:spring-beans:jar:2.5.6:compile [INFO] | +- org.springframework:spring-context:jar:2.5.6:compile [INFO] | +- org.springframework:spring-context-support:jar:2.5.6:compile [INFO] | +- org.springframework:spring-core:jar:2.5.6:compile [INFO] | \- org.springframework:spring-tx:jar:2.5.6:compile