I\'m trying to read deployment specific information from a properties file in my wildfly configuration folder. I tried this:
@Singleton
@Startup
public class
The simplest thing you can do is to run standalone.sh
with a -P
option referencing your properties file (you need a URL file:/path/to/my.properties
, or put the file in $WILDFLY_HOME/bin
).
Then all properties from the file will be loaded as system properties.
For injecting configuration properties into your application classes, have a look at DeltaSpike Configuration, which supports different property sources like system properties, environment variables, JNDI entries and hides the specific source from your application.
Alternatively, to avoid setting system properties (which will be global in the sense of being visible to all applications deployed to your WildFly instance), you can also define a custom property source for DeltaSpike reading a properties file from any given location, and these properties will be local to your application.