Skip to content

ConfiguringYourApp

John Ament edited this page Aug 29, 2016 · 8 revisions

Application Configuration With Apache DeltaSpike

Apache DeltaSpike is a CDI utility library, featuring some configuration support.

Currently, processing CLI args is not supported in Hammock. See also https://github.com/hammock-project/hammock/issues/5, however they are available as injectable resources, see also https://docs.jboss.org/weld/reference/2.3.4.Final/en-US/html/environments.html#_cdi_se_module

You have two ways of configuring via DeltaSpike, out of the box. More are to come.

Classpath Properties

On your classpath, you can add a hammock.properties which contains the configuration entries:

  • webserver.port - the listener port - default 8080
  • file.dir - the location to read static files from - default /tmp
  • metrics.uri - the base URI for the Metrics Admin servlet - default /metrics/*

Custom Property Sources

You can implement any number of custom config sources for your application. One easy way, if you're pointing to a local file, is to extend from PropertiesConfigSource and point to your configuration file, either on the classpath or on the file system.

You can also register the CLIPropertySource with your own Properties instance. Full Details available at https://deltaspike.apache.org/documentation/core.html#DeltaSpikeConfiguration

Hammock will also read properties from the command line, in the form of --key=value or -key value.

Looking for more? There are more modules available or get to testing

Clone this wiki locally