View Full Version : Qualified Producer method overrides non-qualified injection

06-15-2010, 04:57 AM
Good day,

I'm trying to get dependency working using Resin 4.0.7. I have a bean that can be injected in 2 ways:

Via a normal constructor injection
Via a producer method that requires a "qualifier" and uses an injection point.

Here is my code:

public class MyBeanProducer {

public MyBean produce(InjectionPoint ip) {
return new MyBean("qualified");

@Target( { ElementType.TYPE, ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD })
public @interface MyQualifier {

public static class MyBean {

private String txt = "default";

public MyBean() {

MyBean(String txt) {
this.txt = txt;

public String toString() {
return txt;


However, upon injecting MyBean into a class without using the qualifier, I get the instance that was produced by the producer method instead of the instance that should have been created via the @Inject constructor. According to my understanding of the spec, only when I use the qualifier should I get the qualified instance of MyBean that used the producer method - this is also how it works with Weld.


(PS sorry about the formatting, but "preview post" throws an exception, so I can't preview)

06-16-2010, 12:31 AM
I just checked with the internal build, and that case is working now.

It'll be probably next week before we can get a clean snapshot as we're finishing up the CDI TCK.