Repository: incubator-tamaya-site Updated Branches: refs/heads/master 2feee6976 -> 5675df62c
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_mutable_config.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_mutable_config.adoc b/content/documentation-new/extensions/mod_mutable_config.adoc index 237572c..478acee 100644 --- a/content/documentation-new/extensions/mod_mutable_config.adoc +++ b/content/documentation-new/extensions/mod_mutable_config.adoc @@ -14,14 +14,14 @@ Tamaya _Mutable Configuration_ is an extension module. Refer to the link:../exte === What functionality this module provides ? -Tamaya +Configuration+ by default is read-only, which covers must of the use cases. But there are many legit scenarios ++Config+ instances by default are read-only, which covers must of the use cases. But there are many legit scenarios where configuration should be written back to backend systems or the local file system. This module adds this functionality. === Compatibility -The module is based on Java 7, so it can be used with Java 7 and beyond. +The module is based on Java 8, so it can be used with Java 8 and beyond. === Installation @@ -40,24 +40,24 @@ To benefit from configuration mutability support you only must add the correspon === Core Architecture -==== Accessing MutableConfiguration +==== Accessing MutableConfig -The core of the module is the +MutableConfigurationProvider+ singleton, which provides access to +MutableConfiguration+ -instance, which extends +Configuration+. This interface adds additional methods to add/update or remove property values. -Hereby each +MutableConfiguration+ manages a transaction like context, which includes +The core of the module is the +MutableConfigProider+ singleton, which provides access to +MutableConfig+ +instance, which extends +Config+. This interface adds additional methods to add/update or remove property values. +Hereby each +MutableConfig+ manages a transaction like context, which includes a UUID that identifes a change. -Backends for writing changes applied umst implement +MutablePropertySource+, which extends +PropertySource+. -Registrations and ordering policies are exact the same as with ordinary property sources, but +Backends for writing changes applied umst implement +MutableConfigSource+, which extends +ConfigSource+. +Registrations and ordering policies are exact the same as with ordinary config sources, but mutable property sources can be targeted by config write operations. -The example below shows how a +MutableConfiguration+ can be obtained ,values added, removed and +The example below shows how a +MutableConfig+ can be obtained ,values added, removed and finally changes written back to the backend: [source,java] .Accessing and changing configuration -------------------------------------------- -MutableConfiguration config = MutableConfigurationProvider - .createMutableConfiguration(); +MutableConfig config = MutableConfigProvider + .createMutableConfig(); config.put("newKey", "newValue") .put("anotherKey", "updatedValue") .remove("valueNotValid") @@ -65,36 +65,36 @@ config.put("newKey", "newValue") -------------------------------------------- In the above scenario we use the system's _default_ configuration as the backend to be used. -We can also pass any +Configuration+ to render it into a mutable instance, e.g. +We can also pass any +Config+ to render it into a mutable instance, e.g. [source,java] .Explicitly passing the backing configuration -------------------------------------------- -Configuration config = ...; -MutableConfiguration config = MutableConfigurationProvider - .createMutableConfiguration(config); +Config config = ...; +MutableConfig config = MutableConfigProvider + .createMutableConfig(config); -------------------------------------------- -NOTE: If a configuration does not contain any +MutablePropertySource+ instances, - a +ConfigurationException+ is thrown since it would not be able to accept +NOTE: If a configuration does not contain any +MutableConfigSource+ instances, + a +IllegalArgumentException+ is thrown since it would not be able to accept any changes. -Following we show the possible methods you can use to create a +MutableConfiguration+. +Following we show the possible methods you can use to create a +MutableConfig+. We will show in the following sections more details on the options provided... [source, java] --------------------------------------------- -public final class MutableConfigurationProvider { +public final class MutableConfigProvider { - private MutableConfigurationProvider(){} + private MutableConfigProvider(){} - public static MutableConfiguration createMutableConfiguration(); - public static MutableConfiguration createMutableConfiguration( + public static MutableConfig createMutableConfig(); + public static MutableConfig createMutableConfig( ChangePropagationPolicy changePropgationPolicy); - public static MutableConfiguration createMutableConfiguration(Configuration configuration); - public static MutableConfiguration createMutableConfiguration( - Configuration configuration, + public static MutableConfig createMutableConfig(Config configuration); + public static MutableConfig createMutableConfig( + Config configuration, ChangePropagationPolicy changePropgationPolicy); [...] @@ -105,33 +105,33 @@ As we have not yet shown it, +MutableConfiguration+ is defined as follows: [source, java] --------------------------------------------- -public interface MutableConfiguration extends Configuration { +public interface MutableConfig extends Config { void store(); ConfigChangeRequest getConfigChangeRequest(); ChangePropagationPolicy getChangePropagationPolicy(); - MutableConfiguration put(String key, String value); - MutableConfiguration putAll(Map<String, String> properties); - MutableConfiguration remove(Collection<String> keys); - MutableConfiguration remove(String... keys); + MutableConfig put(String key, String value); + MutableConfig putAll(Map<String, String> properties); + MutableConfig remove(Collection<String> keys); + MutableConfig remove(String... keys); } --------------------------------------------- -===== Targeting specific MutablePropertySources +===== Targeting specific MutableConfigSources -A +Configuration+ may have multiple +MutablePropertySource+ instances present. These are members of Tamaya's ordered list of -+PropertySources+ to evaluate the configuration. Nevertheless writing back changes requires additional aspects to +A +Config+ may have multiple +MutableConfigSource+ instances present. These are members of Tamaya's ordered list of ++ConfigSources+ to evaluate the configuration. Nevertheless writing back changes requires additional aspects to be considered: -* Should changes written target all mutable property sources? Or should a change only - target the most significant instance (hereby not writing the change to less significant property sources)? -* Or should a change be applied only to specific mutable property source(s), regardless its position in the +* Should changes written target all mutable config sources? Or should a change only + target the most significant instance (hereby not writing the change to less significant config sources)? +* Or should a change be applied only to specific mutable config source(s), regardless its position in the processing chain? -Therefore a _default_ +ChangePropagationPolicy+ can be applied on a +MutableConfiguration+ instance, which allows to +Therefore a _default_ +ChangePropagationPolicy+ can be applied on a +MutableConfig+ instance, which allows to control this aspect: [source,java] @@ -140,23 +140,23 @@ control this aspect: public interface ChangePropagationPolicy { /** * Method being called when a multiple key/value pairs are added or updated. - * @param propertySources all property sources, including read-only property sources, of the current configuration, + * @param configSources all config sources, including read-only config sources, of the current configuration, * never null. * @param configChange the configuration change, not null. */ - void applyChange(ConfigChangeRequest configChange, Collection<PropertySource> propertySources); + void applyChange(ConfigChangeRequest configChange, Collection<ConfigSource> configSources); } -------------------------------------------- -By default, changes are applied to all registered +MutablePropertySource+ instances +By default, changes are applied to all registered +MutableConfigSource+ instances similarly. -The +MutableConfigurationProvider+ singleton also provides the most common +The +MutableConfigProvider+ singleton also provides the most common change propagation policy implementations: [source, java] --------------------------------------------- -public final class MutableConfigurationProvider { +public final class MutableConfigProvider { [...] @@ -189,46 +189,46 @@ may be mutable, how overriding should work and to which backends finally any cha === Configuration Changes -This module does not handle detection of changes to the overall system's +Configuration+. This can be done in +This module does not handle detection of changes to the overall system's +Config+. This can be done in several ways, e.g. by: * using the _tamaya-events_ extension, which can be used to observe the system's configuration and publishing events when things have been changed. -* The SPI implementing the +MutableConfigurationBackendSpi+ may inform/update any affected +PropertySource, - PropertySourceProvider+ instances about the changes applied. +* The SPI implementing the +MutableConfigBackendSpi+ may inform/update any affected +ConfigSource, + ConfigSourceProvider+ instances about the changes applied. === Supported Backends Multiple backends are supported. E.g. _tamaya-etcd_ also registers corresponding SPI implementations/backends. This module comes with -the following +MutablePropertySource+ implementations: +the following +MutableConfigSource+ implementations: -* +MutablePropertySource+ resources, targeting local +.properties+ files, using the +java.util.Properties+ +* +MutablePropertiesConfigSource+ resources, targeting local +.properties+ files, using the +java.util.Properties+ format. -* +MutableXmlPropertySource+ resources, targeting local +.xml+ property files, using the +java.util.Properties+ +* +MutableXmlPropertiesConfigSource+ resources, targeting local +.xml+ property files, using the +java.util.Properties+ XML format. === SPIs -The module defines +MutableConfigurationProviderSpi+, that is used as a delegate by the +MutableConfigurationProvider+ +The module defines +MutableConfigProviderSpi+, that is used as a delegate by the +MutableConfigProvider+ singleton accessor: [source,java] .SPI: MutableConfigurationProviderSpi -------------------------------------------------- -public interface MutableConfigurationProviderSpi { +public interface MutableConfigProviderSpi { /** - * Creates a new {@link MutableConfiguration} with {@code autoCommit = false} as default. + * Creates a new {@link MutableConfig} with {@code autoCommit = false} as default. * * @param configuration the configuration, not null. * @param propagationPolicy policy that defines how changes are published to the property * sources. * @return a new mutable configuration instance. */ - MutableConfiguration createMutableConfiguration(Configuration configuration, - ChangePropagationPolicy propagationPolicy); + MutableConfig createMutableConfig(Config configuration, + ChangePropagationPolicy propagationPolicy); } -------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_optional.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_optional.adoc b/content/documentation-new/extensions/mod_optional.adoc index 0b7d948..29ed2fc 100644 --- a/content/documentation-new/extensions/mod_optional.adoc +++ b/content/documentation-new/extensions/mod_optional.adoc @@ -24,7 +24,7 @@ Additionally an +EvaluationPolicy+ lets you define the precedence of configured === Compatibility -The module is based on Java 7, so it will not run on Java 7 and beyond. +The module is based on Java 8, so it will not run on Java 8 and beyond. === Installation http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_remote.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_remote.adoc b/content/documentation-new/extensions/mod_remote.adoc index 9c234f1..fb7ffa9 100644 --- a/content/documentation-new/extensions/mod_remote.adoc +++ b/content/documentation-new/extensions/mod_remote.adoc @@ -21,7 +21,7 @@ provided with the Tamaya _server_ module . === Compatibility -The module is based on Java 7, so it will not run on Java 7 and beyond. +The module is based on Java 8, so it will not run on Java 8 and beyond. === Installation @@ -87,7 +87,7 @@ first accessible URL determines the configuration read. [source, java] ----------------------------------------------- -public class RemotePropertySource extends BaseRemotePropertySource{ +public class RemoteConfigSource extends BaseRemoteConfigSource{ @Override protected Collection<URL> getAccessURLs() { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_resolver.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_resolver.adoc b/content/documentation-new/extensions/mod_resolver.adoc index ad95d14..dac7735 100644 --- a/content/documentation-new/extensions/mod_resolver.adoc +++ b/content/documentation-new/extensions/mod_resolver.adoc @@ -14,14 +14,14 @@ Tamaya _Resolver_ is an extension module. Refer to the link:../extensions.html[e Tamaya _Resolver_ is an extension module. Refer to the link:../extensions.html[extensions documentation] for further details about modules. -Tamaya Resolver provides a dynamic resolution mechanism, which allows to use UNIX-styled (+${...}+ placeholder +Tamaya Resolver provides a extendible dynamic resolution mechanism. It allows to use UNIX-styled (+${...}+ placeholder expressions in your configuration values. The resolver hereby supports transitive resolution and also prevents cycles to loop endlessly. === Compatibility -The module is based on Java 7, so it can be used with Java 7 and beyond. +The module is based on Java 8, so it can be used with Java 8 and beyond. === Installation @@ -37,7 +37,7 @@ To benefit from dynamic value resolution you only must add the corresponding dep </dependency> ----------------------------------------------- -The module automatically registers an according +PropertyFilter+ that is automatically called, whenever a value +The module automatically registers an according +Filter+ that is automatically called, whenever a value is accessed. @@ -73,7 +73,7 @@ Currently the module defines the following resolvers: === SPI: Implementing your own Resolvers -The module also provides a small but powerful SPI for adding your own resolver implementations. Basically the +The module also provides a small SPI for adding your own resolver implementations. Basically the first and most important thing to do is implementing the +ExpressionResolver+ interface: .Implementing a Custom Resolver http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_resources.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_resources.adoc b/content/documentation-new/extensions/mod_resources.adoc index 2e06053..131909b 100644 --- a/content/documentation-new/extensions/mod_resources.adoc +++ b/content/documentation-new/extensions/mod_resources.adoc @@ -17,7 +17,7 @@ descriptive ant-styled resource patterns. === Compatibility -The module is based on Java 7, so it can be used with Java 7 and beyond. +The module is based on Java 8, so it can be used with Java 8 and beyond. === Installation @@ -109,17 +109,17 @@ location, hereby traversing down all folders: [source, java] ------------------------------------------------------------- -public class PathBasedPropertySourceProvider implements PropertySourceProvider { +public class PathBasedConfigSourceProvider implements ConfigSourceProvider { @Override - public Collection<PropertySource> getPropertySources() { + public Iterable<ConfigSource> getConfigSources(ClassLoader classloader) { List<PropertySource> propertySources = new ArrayList<>(); - Collection<URL> resources = ConfigResources.getResourceResolver().getResources("META-INF/cfg/**/*.properties"); + Collection<URL> resources = ConfigResources.getResourceResolver().getResources(classLoader, "META-INF/cfg/**/*.properties"); for(URL url:resources){ Properties props = new Properties(); try(InputStream is = url.openStream()){ props.load(is); - propertySources.add(new PropertiesBasedPropertySource(url.toString(), props)); + propertySources.add(new PropertiesBasedConfigSource(url.toString(), props)); } catch(Exception e){ e.printStackTrace(); @@ -129,11 +129,11 @@ public class PathBasedPropertySourceProvider implements PropertySourceProvider { return propertySources; } - private final static class PropertiesBasedPropertySource implements PropertySource { + private final static class PropertiesBasedConfigSource implements ConfigSource { private String name; private Map<String,String> properties = new HashMap<>(); - public PropertiesBasedPropertySource(String name, Properties props) { + public PropertiesBasedConfigSource(String name, Properties props) { this.name = name; props.forEach((k,v) -> this.properties.put(k.toString(), v.toString())); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_server.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_server.adoc b/content/documentation-new/extensions/mod_server.adoc index 52081b6..35338d9 100644 --- a/content/documentation-new/extensions/mod_server.adoc +++ b/content/documentation-new/extensions/mod_server.adoc @@ -20,7 +20,7 @@ configuration properties. === Compatibility -The module is based on Java 7, so it will not run on Java 7 and beyond. +The module is based on Java 8, so it will not run on Java 8 and beyond. === Installation http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_spring.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_spring.adoc b/content/documentation-new/extensions/mod_spring.adoc index 798431b..bc4d760 100644 --- a/content/documentation-new/extensions/mod_spring.adoc +++ b/content/documentation-new/extensions/mod_spring.adoc @@ -120,13 +120,14 @@ public class ConfiguredSpringBean { @Autowired private Environment env; - @Config(value = "alternateMessage", required = false) <3> + @ConfigProperty(key = "alternateMessage", required = false) <3> private String anotherMessage = "N/A"; - @Config("java.version") + @ConfigProperty(key="java.version") private String javaVersion; - @Config(value={"number", "testNum", "[notavailable]"}, defaultValue="23") <4><5> + @ConfigProperty(key="number", defaultValue="23") <4> + @ConfigFallbackKeys=({"testNum", "[notavailable]"}) <5> private int testNumber; ... @@ -156,7 +157,7 @@ Integration into Spring also includes for support for _dynamic values_: [source, java] -------------------------------------------------------- -@Config(value = "foreground.color", required = false, defaultValue = "#DDDDDD") +@ConfigProperty(key = "foreground.color", required = false, defaultValue = "#DDDDDD") private DynamicValue<Color> foregroundColor; -------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_usagetracker.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_usagetracker.adoc b/content/documentation-new/extensions/mod_usagetracker.adoc index e0bd8c7..e773c59 100644 --- a/content/documentation-new/extensions/mod_usagetracker.adoc +++ b/content/documentation-new/extensions/mod_usagetracker.adoc @@ -20,7 +20,7 @@ VM. === Compatibility -The module is based on Java 7, so it can be used with Java 7 and beyond. +The module is based on Java 8, so it can be used with Java 8 and beyond. === Installation @@ -44,7 +44,7 @@ It checks the stacktrace to evaluate the calling code location, hereby any unwan ommitted from the stacktrace. Also the maximal length of the stacktrace retained can be constraint in length. The usages are recorded as +Usage+ instances. Hereby for each parameter accessed a corresponding +Usage+ instance is created. It can be accessed by calling +Usage ConfigUsageStats.getUsage(String key)+. Usage -statistics for calling +Configuration.getProperties()+ can be obtained calling +Usage getUsageAllProps();+. +statistics for calling +Config.getPropertyNames()+ can be obtained calling +Usage getUsageAllProps();+. Usage tracking is disabled by default. It can be enabled by calling +ConfigUsageStats.enableUsageTracking(true);+. +ConfigUsageStats.isUsageTrackingEnabled()+ returns the current tracking status. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_validation.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_validation.adoc b/content/documentation-new/extensions/mod_validation.adoc index 5b239cb..0b97ccf 100644 --- a/content/documentation-new/extensions/mod_validation.adoc +++ b/content/documentation-new/extensions/mod_validation.adoc @@ -20,7 +20,7 @@ defined in a Tamaya Metaconfiguration XML file. === Compatibility -The module is based on Java 7, so it will run on Java 7 and beyond. +The module is based on Java 8, so it will run on Java 8 and beyond. === Installation http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_vertx.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_vertx.adoc b/content/documentation-new/extensions/mod_vertx.adoc index eef576b..a066a05 100644 --- a/content/documentation-new/extensions/mod_vertx.adoc +++ b/content/documentation-new/extensions/mod_vertx.adoc @@ -34,7 +34,7 @@ your module: ----------------------------------------------- <dependency> <groupId>org.apache.tamaya.ext</groupId> - <artifactId>tamaya-vertx-alpha</artifactId> + <artifactId>tamaya-vertx</artifactId> <version>{tamaya_version}</version> </dependency> ----------------------------------------------- @@ -42,9 +42,6 @@ your module: === The Functionality Provided -NOTE: This module is in alpha state. Please give feedback via our JIRA, so we can improve it. - - ==== Extending AbstractConfiguredVerticle Main artifact is the +AbstractConfiguredVerticle+ class, which implements a @@ -180,9 +177,9 @@ see the code snippet from the implementation: [source, java] ----------------------------------------------- -@Config(value = "tamaya.vertx.config.map", defaultValue = "CONFIG-MAP") +@ConfigProperty(key = "tamaya.vertx.config.map", defaultValue = "CONFIG-MAP") private String mapBusTarget; -@Config(value = "tamaya.vertx.config.value", defaultValue = "CONFIG-VAL") +@ConfigProperty(key = "tamaya.vertx.config.value", defaultValue = "CONFIG-VAL") private String valBusTarget; ----------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/extensions/mod_yaml.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/extensions/mod_yaml.adoc b/content/documentation-new/extensions/mod_yaml.adoc index ceef59a..f6c07b6 100644 --- a/content/documentation-new/extensions/mod_yaml.adoc +++ b/content/documentation-new/extensions/mod_yaml.adoc @@ -20,7 +20,7 @@ use intendation for expressing hierarchy, which makes yaml configuration files v === Compatibility -The YAML module is based on Java 7, so it will run on Java 7 and beyond. +The YAML module is based on Java 8, so it will run on Java 8 and beyond. === Installation @@ -45,7 +45,7 @@ For reading YAML based onfiguration most easily a +YAMLFormat+ can be provided: [source, java] ----------------------------------------------- -PropertySource ps = ConfigurationFormats.createPropertySource( +PropertySource ps = ConfigurationFormats.createConfigSource( getClassLoader().getResource("myFileConfig.yaml"), new YAMLFormat())); ----------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/5675df62/content/documentation-new/usecases.adoc ---------------------------------------------------------------------- diff --git a/content/documentation-new/usecases.adoc b/content/documentation-new/usecases.adoc index 0d0d4e0..d97d2c2 100644 --- a/content/documentation-new/usecases.adoc +++ b/content/documentation-new/usecases.adoc @@ -16,7 +16,7 @@ This can only be achieved by providing a static accessor, e.g. [source,java] ------------------------------------------------------------ -Configuration config = Configuration.current(); +Config config = ConfigProvider.getConfig(); ------------------------------------------------------------ The call above should work exactly the same in EE. To enable this the static call must be delegated in the @@ -29,7 +29,7 @@ above: [source,java] ------------------------------------------------------------ @Inject -private Configuration cfg; +private Config cfg; ------------------------------------------------------------ @@ -170,20 +170,14 @@ solution should not try to solve that, but it can provide a significant bunch of * allow client code to listen for configuration changes and react as needed. -=== Minimal Property Source SPI +=== Minimal Config Source SPI -Users expect that implementing an additional configuration property source is as easy as possible. +Users expect that implementing an additional configuration config source is as easy as possible. So there should be an SPI defined that allows any kind of data source to be used for providing configuration data. The interface to be implemented is expected to be minimal to reduce the implementation burden. Default methods should be used where possible, so only a few methods are expected to be required to implement. -=== Scannable Properties - -If possible configuration should be scannable, meaning it should be possible to evaluate the keys available. -The corresponding capabilities should be accessible by a +isScannable()+ method. - - === Combine Configurations Users want to be able to combine different configurations to a new configuration instance. @@ -355,13 +349,13 @@ When combining configuration it must also be possible to override (file/classpat === Configuration Injection As metnioned configuration can be injected by passing a unconfigured instance of an annotated class to the -+Configuration.configure+ static method: ++ConfigurationInjector.configure+ static method: [source, java] .Configuring a POJO ---------------------------------------------------- MyPojo instance = new MyPojo(); -Configuration.configure(instance); +ConfigurationInjector.configure(instance); ---------------------------------------------------- Hereby @@ -377,17 +371,17 @@ Hereby * The value evaluated for a property (before type conversion) must be adaptable as well. * It must be possible to observe configuration changes. -The following annotations must be present at least: +Similar annotations must be present at least: -* *@ConfiguredProperty* defining the key of the property to be evaluated. It takes an optional value, defining the +* *@Config* defining the key of the property to be evaluated. It takes an optional value, defining the property name. It must be possible to add multiple annotations of this kind to define an order of evaluation of possible keys. -* *@DefaultValue* (optional) defines a default String value, to be used, when no other key is present. -* *@WithConfig* (optional) defines the name of the configuration to be used. Similar to +@ConfiguredProperty+ multiple +* The *@Config* annotation should also provide an optional default String value, to be used, when no other key is present. +* *@WithConfig* (optional) defines the name of the configuration to be used. Similar to +@Config+ multiple configuration can be defined for lookup. * *@WithConfigOperator* allows to adapt the String value evaluated, *before* it is passed as input to injection or type conversion. -* *@WithPropertyAdapter* allows to adapt the conversion to the required target type, hereby overriding any default +* *@WithConverter* allows to adapt the conversion to the required target type, hereby overriding any default conversion in place. * *@WithLoadPolicy* allows to define the policy for (re)injection of configured values. * *@ObservesConfigChange* allows to annotate methods that should be called on configuration changes. @@ -414,27 +408,21 @@ The following snippet illustrates the requirements: ---------------------------------------------------- public interface MyConfig { - @ConfiguredProperty("myCurrency") - @DefaultValue("CHF") + @Config(key="myCurrency", defaultValue="CHF") String getCurrency(); - @ConfiguredProperty("myCurrencyRate") + @Config(key="myCurrencyRate") Long getCurrencyRate(); - @ConfigChange - default configChanged(ConfigChange event){ - ... - } - } ---------------------------------------------------- -Templates can be accessed by calling the +Configuration.current(Class)+ method: +Templates can be accessed by calling the +ConfigInjector.createTemplate(Class)+ method: [source, java] .Accessing a type safe Configuration Template ---------------------------------------------------- -MyConfig config = Configuration.current(MyConfig.class); +MyConfig config = ConfigInjector.createTemplate(MyConfig.class); ---------------------------------------------------- [[RequirementsServer]] @@ -481,8 +469,4 @@ on +Configuration+. * +UnaryOperator<Configuration>+ for converting into other version of +Configuration+. * +ConfigQuery<T>+ extending +Function<T, Configuration>+. -[[RequirementsNonFunctional]] -=== Non Functional Requirements -THe following non-functional requirements must be met: -* tbd
