users@glassfish.java.net

Re: Environment Entry in EJB3.1

From: <glassfish_at_javadesktop.org>
Date: Tue, 30 Mar 2010 10:16:46 PDT

Yes, the name of an environment entry can now be prepended with java:app/env to define it at the application-level scope. For example, add the following to an META-INF/application.xml file within the .ear :

  <env-entry>
     <env-entry-name>java:app/env/value1</env-entry-name>
     <env-entry-type>java.lang.Integer</env-entry-type>
     <env-entry-value>18338</env-entry-value>
  </env-entry>

You can then look it up via :

new InitialContext().lookup("java:app/env/value1")

or inject it as

@Resource(lookup="java:app/env/value1")
String value1;
[Message sent by forum member 'ksak']

http://forums.java.net/jive/thread.jspa?messageID=394520