[jboss-jira] [JBoss JIRA] (WFLY-1727) Allow injection of resources from external JNDI contexts

Jan Martiska (JIRA) jira-events at lists.jboss.org
Tue Jul 30 06:30:26 EDT 2013


    [ https://issues.jboss.org/browse/WFLY-1727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793755#comment-12793755 ] 

Jan Martiska commented on WFLY-1727:
------------------------------------

I think there is still some misunderstanding between us about the functionality..
Your enhanced test now injects the external contexts, like this:

{noformat}
@Resource(lookup = "java:global/ldap")
private InitialDirContext ldap;
{noformat}

this surely works, no doubt. But I meant injecting *resources* from inside the external contexts.
You can use the "ldap" variable as obtained in the code above to do lookups like

{noformat}
LdapCtx c = (LdapCtx)ldap.lookup("dc=jboss,dc=org");
{noformat}

and obtain objects (LdapCtx in this example) from the external context. But currently, you have to do this in two steps - as I did in these two examples. First, you inject (with @Resource) the external context, then you perform a lookup programatically.

What I meant is a possibility to be able to obtain the LdapCtx in just one step, one @Resource injection, something like ...

{noformat}
@Resource(lookup = "java:global/ldap#dc=jboss,dc=org")
private LdapCtx c;
{noformat}

(not sure about the possible exact syntax for it, but it could look similarly)
Which would automatically perform a lookup inside the InitialDirContext, which is stored under java:global/ldap.
Would that be possible?
                
> Allow injection of resources from external JNDI contexts
> --------------------------------------------------------
>
>                 Key: WFLY-1727
>                 URL: https://issues.jboss.org/browse/WFLY-1727
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: Naming
>            Reporter: Jan Martiska
>            Assignee: Eduardo Martins
>
> The ability to federate external JNDI contexts into WildFly's JNDI namespaces was introduced with WFLY-287.
> Currently, it is not possible to programatically inject resources into applications (eg. using @Resource annotation) from the federated contexts. It would be a nice to have feature.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list