@ -70,8 +70,12 @@ For instance, if a <code class="literal">DataSource</code> has open connections
@@ -70,8 +70,12 @@ For instance, if a <code class="literal">DataSource</code> has open connections
Then, the next time something borrows a connection from the pool, it gets one with the new URL.</p><p>Refresh scope beans are lazy proxies that initialize when they are used (that is, when a method is called), and the scope acts as a cache of initialized values.
To force a bean to re-initialize on the next method call, you must invalidate its cache entry.</p><p>The <codeclass="literal">RefreshScope</code> is a bean in the context and has a public <codeclass="literal">refreshAll()</code> method to refresh all beans in the scope by clearing the target cache.
The <codeclass="literal">/refresh</code> endpoint exposes this functionality (over HTTP or JMX).
To refresh an individual bean by name, there is also a <codeclass="literal">refresh(String)</code> method.</p><divclass="note"style="margin-left: 0.5in; margin-right: 0.5in;"><tableborder="0"summary="Note"><tr><tdrowspan="2"align="center"valign="top"width="25"><imgalt="[Note]"src="images/note.png"></td><thalign="left">Note</th></tr><tr><tdalign="left"valign="top"><p><codeclass="literal">@RefreshScope</code> works (technically) on an <codeclass="literal">@Configuration</code> class, but it might lead to surprising behavior.
For example, it does <spanclass="strong"><strong>not</strong></span> mean that all the <codeclass="literal">@Beans</code> defined in that class are themselves in <codeclass="literal">@RefreshScope</code>.
To refresh an individual bean by name, there is also a <codeclass="literal">refresh(String)</code> method.</p><p>To expose the <codeclass="literal">/refresh</code> endpoint, you need to add following configuration to your application:</p><preclass="programlisting"><spanxmlns:d="http://docbook.org/ns/docbook"class="hl-attribute">management</span>:
<spanxmlns:d="http://docbook.org/ns/docbook"class="hl-attribute"> include</span>: refresh</pre><divclass="note"style="margin-left: 0.5in; margin-right: 0.5in;"><tableborder="0"summary="Note"><tr><tdrowspan="2"align="center"valign="top"width="25"><imgalt="[Note]"src="images/note.png"></td><thalign="left">Note</th></tr><tr><tdalign="left"valign="top"><p><codeclass="literal">@RefreshScope</code> works (technically) on an <codeclass="literal">@Configuration</code> class, but it might lead to surprising behavior.
For example, it does not mean that all the <codeclass="literal">@Beans</code> defined in that class are themselves in <codeclass="literal">@RefreshScope</code>.
Specifically, anything that depends on those beans cannot rely on them being updated when a refresh is initiated, unless it is itself in <codeclass="literal">@RefreshScope</code>.
In that case, it is rebuilt on a refresh and its dependencies are re-injected. At that point, they are re-initialized from the refreshed <codeclass="literal">@Configuration</code>).</p></td></tr></table></div></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aname="_encryption_and_decryption"href="#_encryption_and_decryption"></a>1.9 Encryption and Decryption</h2></div></div></div><p>Spring Cloud has an <codeclass="literal">Environment</code> pre-processor for decrypting property values locally.
It follows the same rules as the Config Server and has the same external configuration through <codeclass="literal">encrypt.*</code>.
@ -76,8 +76,12 @@ For instance, if a <code class="literal">DataSource</code> has open connections
@@ -76,8 +76,12 @@ For instance, if a <code class="literal">DataSource</code> has open connections
Then, the next time something borrows a connection from the pool, it gets one with the new URL.</p><p>Refresh scope beans are lazy proxies that initialize when they are used (that is, when a method is called), and the scope acts as a cache of initialized values.
To force a bean to re-initialize on the next method call, you must invalidate its cache entry.</p><p>The <codeclass="literal">RefreshScope</code> is a bean in the context and has a public <codeclass="literal">refreshAll()</code> method to refresh all beans in the scope by clearing the target cache.
The <codeclass="literal">/refresh</code> endpoint exposes this functionality (over HTTP or JMX).
To refresh an individual bean by name, there is also a <codeclass="literal">refresh(String)</code> method.</p><divclass="note"style="margin-left: 0.5in; margin-right: 0.5in;"><tableborder="0"summary="Note"><tr><tdrowspan="2"align="center"valign="top"width="25"><imgalt="[Note]"src="images/note.png"></td><thalign="left">Note</th></tr><tr><tdalign="left"valign="top"><p><codeclass="literal">@RefreshScope</code> works (technically) on an <codeclass="literal">@Configuration</code> class, but it might lead to surprising behavior.
For example, it does <spanclass="strong"><strong>not</strong></span> mean that all the <codeclass="literal">@Beans</code> defined in that class are themselves in <codeclass="literal">@RefreshScope</code>.
To refresh an individual bean by name, there is also a <codeclass="literal">refresh(String)</code> method.</p><p>To expose the <codeclass="literal">/refresh</code> endpoint, you need to add following configuration to your application:</p><preclass="programlisting"><spanxmlns:d="http://docbook.org/ns/docbook"class="hl-attribute">management</span>:
<spanxmlns:d="http://docbook.org/ns/docbook"class="hl-attribute"> include</span>: refresh</pre><divclass="note"style="margin-left: 0.5in; margin-right: 0.5in;"><tableborder="0"summary="Note"><tr><tdrowspan="2"align="center"valign="top"width="25"><imgalt="[Note]"src="images/note.png"></td><thalign="left">Note</th></tr><tr><tdalign="left"valign="top"><p><codeclass="literal">@RefreshScope</code> works (technically) on an <codeclass="literal">@Configuration</code> class, but it might lead to surprising behavior.
For example, it does not mean that all the <codeclass="literal">@Beans</code> defined in that class are themselves in <codeclass="literal">@RefreshScope</code>.
Specifically, anything that depends on those beans cannot rely on them being updated when a refresh is initiated, unless it is itself in <codeclass="literal">@RefreshScope</code>.
In that case, it is rebuilt on a refresh and its dependencies are re-injected. At that point, they are re-initialized from the refreshed <codeclass="literal">@Configuration</code>).</p></td></tr></table></div></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aname="_encryption_and_decryption"href="#_encryption_and_decryption"></a>1.9 Encryption and Decryption</h2></div></div></div><p>Spring Cloud has an <codeclass="literal">Environment</code> pre-processor for decrypting property values locally.
It follows the same rules as the Config Server and has the same external configuration through <codeclass="literal">encrypt.*</code>.
@ -184,9 +184,15 @@ To force a bean to re-initialize on the next method call, you must invalidate it
@@ -184,9 +184,15 @@ To force a bean to re-initialize on the next method call, you must invalidate it
<simpara>The <literal>RefreshScope</literal> is a bean in the context and has a public <literal>refreshAll()</literal> method to refresh all beans in the scope by clearing the target cache.
The <literal>/refresh</literal> endpoint exposes this functionality (over HTTP or JMX).
To refresh an individual bean by name, there is also a <literal>refresh(String)</literal> method.</simpara>
<simpara>To expose the <literal>/refresh</literal> endpoint, you need to add following configuration to your application:</simpara>
<simpara><literal>@RefreshScope</literal> works (technically) on an <literal>@Configuration</literal> class, but it might lead to surprising behavior.
For example, it does <emphasisrole="strong">not</emphasis> mean that all the <literal>@Beans</literal> defined in that class are themselves in <literal>@RefreshScope</literal>.
For example, it does not mean that all the <literal>@Beans</literal> defined in that class are themselves in <literal>@RefreshScope</literal>.
Specifically, anything that depends on those beans cannot rely on them being updated when a refresh is initiated, unless it is itself in <literal>@RefreshScope</literal>.
In that case, it is rebuilt on a refresh and its dependencies are re-injected. At that point, they are re-initialized from the refreshed <literal>@Configuration</literal>).</simpara>