5

is it possible to access Wildfly properties (defined in standalone.xml) through JNDI? Like:

    <system-properties>
        <property name="MY_PROPERTY" value="some value"/>
...
    </system-properties>

and read it in java:

@Resource(lookup = "java:comp/env/MY_PROPERTY") 
private String property;
Pavel Hora
  • 143
  • 1
  • 11

1 Answers1

3

<system-properties> are used to define environment variables and not JNDI variables. Define JNDI variables inside

<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
...
<simple name="java:/env/MY_PROPERTY" value="some value"/>
</bindings>
</subsystem>

Now, you can read it as a JNDI.

Asif Arshad
  • 301
  • 1
  • 10