2

I have a web application in which I want to inject property values (like external server hostname and password - environment dependent). I want to specify the values in the Wildfly configuration.

I thought I will specify simple JNDI binding in the urn:jboss:domain:naming subsystem, and inject property using @Resource annotation, like:

@Resource(name = "java:app/rabbit.login")
private String login;

But in naming subsystem I cannot specify an application-scoped JNDI binding (it is necessary due to security reasons).

How can I specify properties (using JDNI, properties, etc.) in the Wildfly configuration accessible only for specific application?

Magnilex
  • 11,584
  • 9
  • 62
  • 84

1 Answers1

0

If you want that your properties are accessible only at application level just use any startup component (e.g. @Singleton @Startup) and read the properties from a File. Another option is packaging the property in a module, install the module on the application server and include a dependency to the module in your application. See this wiki:

Francesco Marchioni
  • 4,091
  • 1
  • 25
  • 40
  • First option doesn't meets my requirements, because I want to separate configuration from application (in this solution I would need to put .properties file into my jar, but I would like to have this in server configuration). Second option is not secure enougth, beacause any application deployed can read all properties. – Tomasz Jagiełło May 05 '15 at 14:06