[JAVAEETUTORIAL-198] Wrong usage of type in @Resource Created: 23/Jun/13  Updated: 24/Jun/13  Resolved: 24/Jun/13

Status: Resolved
Project: javaeetutorial
Component/s: doc
Affects Version/s: 7.0.1
Fix Version/s: 7.0.2

Type: Bug Priority: Major
Reporter: jd3714att Assignee: Ian Evans
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: annotations


Examples to the use of @Resource are wrong.

@Resources ({
    @Resource(name="myDB" type=javax.sql.DataSource),
    @Resource(name="myMQ" type=javax.jms.ConnectionFactory)

Just to be syntactically correct, the type value either has to be between double quotes, or .class needs to be appended to return the actual Class object. As per the specification, type is defined as "public abstract Class<?> type". Correction of above would look like:

@Resources ({
    @Resource(name="myDB" type=javax.sql.DataSource.class),
    @Resource(name="myMQ" type=javax.jms.ConnectionFactory.class)

I would suggest to extend this case by means of a regex search through the documentation.

Comment by Ian Evans [ 24/Jun/13 ]

Fixed in source. I did a grep through the documentation, and this was the only instance of a class-level @Resource with a type attribute.

Generated at Tue Feb 28 13:03:56 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.