This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208335

Summary: Injecting a POJO shows a warning message
Product: javaee Reporter: arungupta <arungupta>
Component: CDIAssignee: Denis Anisimov <ads>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description arungupta 2012-02-13 12:48:01 UTC
If a POJO is injected using @Inject then the IDE shows the following warning message

"Not enabled eligible for injection beans are found"

This is incorrect and should be fixed.
Comment 1 Denis Anisimov 2012-02-13 12:49:27 UTC
What exactly is incorrect ?
Comment 2 arungupta 2012-02-13 12:51:31 UTC
A POJO can be injected as is, it is a direct target of injection. Why warning ?
Comment 3 Denis Anisimov 2012-02-13 12:55:34 UTC
There can be a number of reasons when typesafe resolution cannot find
eligible for injection element: f.e. bean is disabled, has normal scope and
is not proxyable .

Please describe exact situation :
- class with injected point
- your POJO.

I need all information to be able to reproduce this issue.

POJO is not enough information .
Comment 4 arungupta 2012-02-13 13:02:32 UTC
POJO is:

@Model
public class CustomerName {
    private String value;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}

Injected in a stateless session bean as:


@Stateless
@LocalBean
@Named
@Path("/customers")
public class CustomerSessionBean {

    @PersistenceContext
    EntityManager em;
    @Inject
    CustomerName name;
    List<Customer> cust;

The last line gives the warning message.
Comment 5 Denis Anisimov 2012-02-13 13:26:54 UTC
@javax.enterprise.inject.Model' definition :

@Named
@RequestScoped
@Stereotype
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface Model {}

So it is @RequestedScoped and CustomerName  class has a normal scope.
This is duplicate of issue #201825

*** This bug has been marked as a duplicate of bug 201825 ***
Comment 6 arungupta 2012-02-13 13:30:45 UTC
Thanks, that explains!