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.
- Host: GitHub
- URL: https://github.com/crowdcode-de/jndi-properties-factory
- Owner: crowdcode-de
- Created: 2013-02-05T12:27:58.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-12T15:38:01.000Z (over 13 years ago)
- Last Synced: 2025-06-24T04:12:45.287Z (11 months ago)
- Language: Java
- Homepage:
- Size: 173 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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
jndi-properties-factory
by
Ingo Düppe
is licensed under the
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0).