Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access to Wildfly <system-properties><property> through JNDI

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;
like image 432
Pavel Hora Avatar asked Oct 31 '22 06:10

Pavel Hora


1 Answers

<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.

like image 88
Asif Arshad Avatar answered Nov 11 '22 06:11

Asif Arshad