Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

Your module may have a module class. This class is the "root" bean of the configuration of your module. This means you can add bean properties to the class. When the module is loaded the Node2Bean mechanism will read property values from the configuration and set them in the instance of the module class.

Node nameValue
 modules 

 my-module

 

 config

 

 foo

bar

When using the module class for configuration, create the module configuration in the /modules/<name-of-your-module>/config directory. Bootstrap this data to ensure proper installation and setting of the config node.

An example module class that uses the configuration above would look like this:

MyModule.java
public class MyModule {
    /* You can optionally implement info.magnolia.module.ModuleLifecycle */
    private String foo;
    public String getFoo() {
        return foo;
    }
    public void setFoo(String foo) {
        this.foo = foo;
    }
}

Bean properties can be more complex, nested objects.

 If you want to control processes during the start and stop phase of the module, implement ModuleLifecycle .

  • No labels