users@glassfish.java.net

RE: Environment Entry in EJB3.1

From: Sigal Shaharabani <Sigal.Shaharabani_at_Teledata-Networks.com>
Date: Tue, 6 Apr 2010 11:39:18 +0300

A related question:
What if I want to define it in the Glassfish level and not the
application level?

Thanks in advance
Sigal


-----Original Message-----
From: glassfish_at_javadesktop.org [mailto:glassfish_at_javadesktop.org]
Sent: Tuesday, March 30, 2010 8:17 PM
To: users_at_glassfish.dev.java.net
Subject: Re: Environment Entry in EJB3.1

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net