# @Resource Annotation

The @Resource annotation can be used to inject env-entries, EJBContext, JMS destinations and connection factories, and datasources. For datasources and JMS destinations and connection factories, JBoss uses the `@Resource.mappedName()` attribute. This attribute corresponds to the global JNDI name of the referenced resource. For example, here's how you would use the @Resource annotation to inject a reference to the default datasource:

    @Resource(mappedName="java:/DefaultDS") DataSource ds;

Here's one for a JMS connection factory:

    @Resource(mappedName="java:/ConnectionFactory") ConnectionFactory factory;