[jboss-jira] [JBoss JIRA] (AS7-3056) Definition of <env-entry> is not bound via @Resource when bean does not specify the same name as its interface
Ondřej Chaloupka (Issue Comment Edited) (JIRA)
jira-events at lists.jboss.org
Fri Dec 16 04:51:12 EST 2011
[ https://issues.jboss.org/browse/AS7-3056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651520#comment-12651520 ]
Ondřej Chaloupka edited comment on AS7-3056 at 12/16/11 4:51 AM:
-----------------------------------------------------------------
The mentioned fix does not work for me. For binding env-entry you need to fulfill two conditions:
- the ejb-jar.xml has to be set to name of the interface (<ejb-name>Shared</ejb-name>)
- the @Stateless annotation has to be used for renaming the binding name to the name of interface (@Stateles(name="Shared")).
When you use another combination (e.g. you use the name of impl bean in descriptor or you name the bean in annotation with other name and you use that name in descriptor) the binding does not work.
(And sorry, I didn't describe the core of the problem clearly before)
was (Author: ochaloup):
The mentioned fix does not work for me. For binding env-entry you need to fulfill two conditions:
- the ejb-jar.xml has to be set to name of the interface (<ejb-name>Shared</ejb-name>)
- the @Stateless annotation has to be used for renaming the binding name to the name of interface (@Stateles(name="Shared")).
When you use another combination (e.g. you use the name of impl bean in descriptor or you name the bean in annotation with other name and you use that name in descriptor) the binding does not work.
> Definition of <env-entry> is not bound via @Resource when bean does not specify the same name as its interface
> --------------------------------------------------------------------------------------------------------------
>
> Key: AS7-3056
> URL: https://issues.jboss.org/browse/AS7-3056
> Project: Application Server 7
> Issue Type: Bug
> Reporter: Ondřej Chaloupka
> Assignee: Stuart Douglas
>
> When there is an <env-entry> specified for a bean in ejb-jar.xml file. The bean has to be named with the same name as the name of its interface it is. Otherwise the @Resource annotation does not bind the value from env-entry.
> It means that this code does not work
> {code}
> @Stateless
> public class SharedBean implements Shared {
> @Resource(name = "strWho")
> String strWho;
> ...
> {code}
> For working it has to be specified like:
> {code}
> @Stateless(name = "Shared")
> public class SharedBean implements Shared {
> @Resource(name = "strWho")
> String strWho;
> ...
> {code}
> Test on:
> https://github.com/ochaloup/jboss-as/tree/JBQA-5483-test-migration-enventry-shared
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list