Do the following to create a configuration interface:
-
Create an interface inherited from
com.haulmont.cuba.core.config.Config(not to be confused with the entity classcom.haulmont.cuba.core.entity.Config). -
Add
@Sourceannotation to the interface in order to identify the source (storing method) for parameters:-
SourceType.SYSTEM– the property value will be taken from the system properties of the given JVM, usingSystem.getProperty()method. -
SourceType.APP– the property value will be taken fromapp.propertiesfiles. -
SourceType.DATABASE– the property value will be taken from SYS_CONFIG table.
-
-
Create property access methods (getters / setters). If the property value is not expected to be changed at runtime, setter is not needed. Possible property types are described below.
-
Add
@Propertyannotation defining the property name to getter. -
You can optionally set
@Sourceannotation for a particular property of the interface if its source differs from the interface source.
Example:
@Source(type = SourceType.DATABASE)
public interface SalesConfig extends Config {
@Property("sales.companyName")
String getCompanyName();
}
There is no need to create implementation class for the configuration interface as required proxy will be automatically created.

