public class CDIPropertiesExtension
extends java.lang.Object
implements javax.enterprise.inject.spi.Extension
author=peter country=germanyThese properties can now injected as shown in the following class Author
@PropertyFile("example.properties")
public class Author {
@Property("author");
private String author;
@Property("country")
private String country;
public String getAuthor() {
return author;
}
public String getCountry() {
return country;
}
}
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTIES_FILE_NOT_FOUND
Exception message when the properties couldn't found
|
static java.lang.String |
PROPERTY_BASE_FOLDER
Specifies the base properties folder for the lookup in the file system
|
static java.lang.String |
PROPERTY_PREFER_FILE_SYSTEM
Specifies that the lookup should first attempt to load the file from the file system
By default the classpath is preferred
|
| Constructor and Description |
|---|
CDIPropertiesExtension() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
initializePropertyLoading(javax.enterprise.inject.spi.ProcessInjectionTarget<T> pit)
Prepares the injection process of properties from a property file.
|
public static final java.lang.String PROPERTY_BASE_FOLDER
public static final java.lang.String PROPERTY_PREFER_FILE_SYSTEM
public static final java.lang.String PROPERTIES_FILE_NOT_FOUND
public <T> void initializePropertyLoading(@Observes
javax.enterprise.inject.spi.ProcessInjectionTarget<T> pit)
throws java.io.IOException
T - the generic type of the injection targetpit - The actual target of process injectionjava.io.IOException