deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1001121 - in /websites/staging/deltaspike/trunk/content: ./ documentation/configuration.html documentation/snapshots.html
Date Tue, 15 Nov 2016 01:07:08 GMT
Author: buildbot
Date: Tue Nov 15 01:07:08 2016
New Revision: 1001121

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/documentation/configuration.html
    websites/staging/deltaspike/trunk/content/documentation/snapshots.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Nov 15 01:07:08 2016
@@ -1 +1 @@
-1769707
+1769708

Modified: websites/staging/deltaspike/trunk/content/documentation/configuration.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/configuration.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/configuration.html Tue Nov 15
01:07:08 2016
@@ -351,10 +351,13 @@ application.</p>
 <li>
 <p><code>@ConfigProperty</code> for injection of configured values into
beans</p>
 </li>
+<li>
+<p>interface based configuration</p>
+</li>
 </ul>
 </div>
 <div class="paragraph">
-<p>All three mechanisms are described in the following sections.</p>
+<p>All four mechanisms are described in the following sections.</p>
 </div>
 <div class="sect2">
 <h3 id="_configresolver_methods">ConfigResolver methods</h3>
@@ -747,6 +750,89 @@ obtained in the producer using <code>get
 </div>
 </div>
 <div class="sect1">
+<h2 id="_interface_based_configuration">Interface based configuration</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The interfaces decorated with <code>@Configuration</code> are converted
during CDI startup
+to Beans matching the interface type. Concretely this interface:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Configuration
+public interface MyConfig {
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Will use accessible using:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Inject
+private MyConfig config;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>To define a configuration entry in this mode you define an interface method
+and decorate it with <code>@ConfigProperty</code> exactly as a normal injection:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Configuration
+public interface MyConfig {
+    @ConfigProperty(name = "my.config")
+    String url();
+}</code></pre>
+</div>
+</div>
+<div class="admonitionblock tip">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-tip" title="Tip"></i>
+</td>
+<td class="content">
+this mode also supports primitives like <code>int</code>, <code>boolean</code>,
&#8230;&#8203; as returned types.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The methods are no parameter and not returning void methods.</p>
+</div>
+<div class="paragraph">
+<p>If all your keys use the same prefix you can configure it on <code>@Configuration</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Configuration(prefix = "client.")
+public interface MyConfig {
+    @ConfigProperty(name = "url")
+    String url();
+
+    @ConfigProperty(name = "timeout", defaultValue = "30000")
+    long timeout();
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Finally, you can also access the caching feature of the <code>TypedResolver</code>
through <code>@Configuration</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Configuration(cacheFor = 30, cacheUnit
= TimeUnit.SECONDS)
+public interface MyConfig {
+    @ConfigProperty(name = "url")
+    String url();
+
+    @ConfigProperty(name = "timeout", defaultValue = "30000")
+    long timeout();
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
 <h2 id="_providing_configuration_using_configsources">Providing configuration using
ConfigSources</h2>
 <div class="sectionbody">
 <div class="paragraph">
@@ -882,6 +968,11 @@ implementations provided by DeltaSpike d
 </tr>
 </table>
 </div>
+<div class="paragraph">
+<p>Since 1.8.0 you can also decorate a CDI <code>ConfigSource</code> with
<code>@Source</code> and it will
+be added to DeltaSpike configuration <strong>once the CDI container is started</strong>
(it means
+you can&#8217;t use this source in an <code>Extension</code>).</p>
+</div>
 <div class="sect3">
 <h4 id="_propertyfileconfig">PropertyFileConfig</h4>
 <div class="paragraph">
@@ -973,6 +1064,11 @@ log.</p>
 }</code></pre>
 </div>
 </div>
+<div class="paragraph">
+<p>Since 1.8.0 you can also decorate a CDI <code>ConfigFilter</code> with
<code>@Filter</code> and it will
+be added to DeltaSpike configuration <strong>once the CDI container is started</strong>
(it means
+you can&#8217;t use this source in an <code>Extension</code>).</p>
+</div>
 </div>
 </div>
             </div>
@@ -1027,6 +1123,7 @@ log.</p>
 </li>
 </ul>
 </li>
+<li><a href="#_interface_based_configuration">Interface based configuration</a></li>
 <li><a href="#_providing_configuration_using_configsources">Providing configuration
using ConfigSources</a>
 <ul class="sectlevel2">
 <li><a href="#_configsources_provided_by_default">ConfigSources Provided by Default</a></li>

Modified: websites/staging/deltaspike/trunk/content/documentation/snapshots.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/snapshots.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/snapshots.html Tue Nov 15 01:07:08
2016
@@ -343,7 +343,7 @@ Snapshots provide previews of DeltaSpike
 <div class="listingblock">
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;properties&gt;</span>
-    <span class="tag">&lt;deltaspike.version&gt;</span>1.7.3-SNAPSHOT<span
class="tag">&lt;/deltaspike.version&gt;</span>
+    <span class="tag">&lt;deltaspike.version&gt;</span>1.8.0-SNAPSHOT<span
class="tag">&lt;/deltaspike.version&gt;</span>
 <span class="tag">&lt;/properties&gt;</span></code></pre>
 </div>
 </div>



Mime
View raw message