Martini Package Properties
Overview
Martini's package properties are essential for storing configuration values unique to each package. This feature is beneficial for persisting values, like API access keys or specific settings, within an individual package.
Defining Package Properties
Location and Structure
You can find package properties within the conf/properties
directory of a package:
1 2 3 4 |
|
Custom Naming for Property Files
The naming convention for property files can be adjusted using the package.properties.prefix
in the application properties. Setting a prefix, such as develop
, would look for develop.package.properties
instead of the standard package.properties
. This is useful for handling properties in various environments or for different development teams.
Immediate Reflection of Changes
Modifications to package properties take effect instantly if the package.properties.reload-strategy
is configured to always-check
.
Note: If .properties
files do not exist, they should be manually created in the conf/properties
directory.
Property Merging
Martini merges properties following the package dependency hierarchy.
Example Scenario
petclinic-demo
depends on thepetclinic
package.petclinic
declares:
1 |
|
In petclinic-demo
, this URL is the resolved value. Overriding it in petclinic-demo
would change the resolved value.
Properties not found within the package are inherited from the global application properties.
Modifying Properties via Martini's User Interface
To modify package properties:
- Navigate to the Navigator view.
- Locate and expand your package, then open the
conf
directory. - Open the
.properties
file to make edits. - Add, change, or remove key-value pairs as needed.
Tip: In Martini Desktop, you can quickly find .properties
files using the Open Resource dialog.
Managing Properties Programmatically
Martini's classloader includes a Groovy extension module with methods for managing package properties.
Adding or Changing Properties
1 |
|
Removing Properties
1 |
|
Retrieving Property Values
1 2 3 4 |
|
These methods are specific to the package containing the script.