users@glassfish.java.net
Re: Custom properties in a ejb archive
This message
: [
Message body
] [ More options (
top
,
bottom
) ]
Related messages
: [
Next message
] [
Previous message
] [
In reply to
] [
Next in thread
]
Contemporary messages sorted
: [
by date
] [
by thread
] [
by subject
] [
by author
] [
by messages with attachments
]
From
: <
glassfish_at_javadesktop.org
>
Date
: Wed, 05 Dec 2007 06:42:13 PST
You can use <env-entry> in ejb-jar.xml, and inject or look up the value in implementation classes:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="
http://java.sun.com/xml/ns/javaee
" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
" version="3.0" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
">
<enterprise-beans>
<session>
<ejb-name>FooBean</ejb-name>
<env-entry>
<description>xxx</description>
<env-entry-name>username</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>xxx</env-entry-value>
</env-entry>
@Stateless
public FooBean implements Foo {
@Resource(name="username")
private String username;
You can also look up by the env-entry name:
context.lookup("java:comp/env/username");
-cheng
[Message sent by forum member 'cf126330' (cf126330)]
http://forums.java.net/jive/thread.jspa?messageID=248652
This message
: [
Message body
]
Next message
:
Stephen Connolly: "Re: Custom properties in a ejb archive"
Previous message
:
Stephen Connolly: "Re: Interop with Glassfish and other application servers"
In reply to
:
glassfish_at_javadesktop.org: "Custom properties in a ejb archive"
Next in thread
:
Stephen Connolly: "Re: Custom properties in a ejb archive"
Contemporary messages sorted
: [
by date
] [
by thread
] [
by subject
] [
by author
] [
by messages with attachments
]