Bug 208335 - Injecting a POJO shows a warning message
Injecting a POJO shows a warning message
Status: RESOLVED DUPLICATE of bug 201825
Product: javaee
Classification: Unclassified
Component: CDI
7.1
PC All
: P3 (vote)
: TBD
Assigned To: Denis Anisimov
issues@javaee
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-13 12:48 UTC by arungupta
Modified: 2012-02-13 13:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo