An open API service indexing awesome lists of open source software.

https://github.com/crowdcode-de/jndi-properties-factory

Small helper classes to inject Properties objects into the jndi tree of JBoss AS 7.
https://github.com/crowdcode-de/jndi-properties-factory

Last synced: 10 months ago
JSON representation

Small helper classes to inject Properties objects into the jndi tree of JBoss AS 7.

Awesome Lists containing this project

README

          

## PropertiesFactory

JNDI-Properties provides two simple JNDI ObjectFactory classes that enable you to bind a properties file as a Properties object into the jndi tree of JBoss AS 7.
These Properties objects can easily be accessed via the `@Resource` annotation.

@Resource(mappedName="java:/app-config")
private java.util.Properties properties;

You can choose between `PropertiesFileFactory` or `PropertiesClasspathFactory` class.
`PropertiesFileFactory` loads the properties from the filesystem via an absolute or relative path. The `PropertiesClasspathFactory` class loads the properties from classpath.

###JBoss AS 7 Setup:

For setting up a JBoss AS7 module put into the modules folder a subfolder structure like `de/crowdcode/jndi/properties/main`. And in the main folder place the `jndi-properties.jar` and a `module.xml` file. You can also place your properties files in here too.

The `module.xml` should look like this:










####Configuring of `PropertyFileFactory`

Define the JNDI Binding in the `standalone.xml`:





And as JBoss AS 7.1.1 doesn't support configuration of ObjectFactories, you need to define a system property with the jndi name as key name.



#####Configuring of `PropertyClasspathFactory`







Add your properties files into the de/crowdcode/jndi/properties folder. For instance a app-config.properties file. The `PropertyClasspathFactory` provides two options to define the properties file. First, the jndi name ends with the properties filename. So the jndi name `java:/app-config` leads to `app-config.properties`. Second, you define a system property `java:/app-config` that contain the properties file name.

##License


Creative Commons Lizenzvertrag





jndi-properties-factory

by
Ingo Düppe
is licensed under the
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0).