diff --git a/.gitignore b/.gitignore
index de858536..7279b4fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,4 +22,5 @@ _site/
.project
sample-pages
.class
-antrun
\ No newline at end of file
+antrun
+target
\ No newline at end of file
diff --git a/docs/spring-cloud-commons-docs.iml b/docs/spring-cloud-commons-docs.iml
deleted file mode 100644
index c16e7389..00000000
--- a/docs/spring-cloud-commons-docs.iml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/target/antrun/build-main.xml b/docs/target/antrun/build-main.xml
deleted file mode 100644
index 7843a44b..00000000
--- a/docs/target/antrun/build-main.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/target/checkstyle-cachefile b/docs/target/checkstyle-cachefile
deleted file mode 100644
index 5d2c9180..00000000
--- a/docs/target/checkstyle-cachefile
+++ /dev/null
@@ -1,2 +0,0 @@
-#Tue Aug 29 11:13:15 UTC 2017
-configuration*?=DDAFDE728981B5AF5B26FADDDDE6B592442900FA
diff --git a/docs/target/checkstyle-checker.xml b/docs/target/checkstyle-checker.xml
deleted file mode 100644
index 79233ddb..00000000
--- a/docs/target/checkstyle-checker.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/target/checkstyle-header.txt b/docs/target/checkstyle-header.txt
deleted file mode 100644
index d6456956..00000000
--- a/docs/target/checkstyle-header.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/docs/target/checkstyle-result.xml b/docs/target/checkstyle-result.xml
deleted file mode 100644
index 472022e4..00000000
--- a/docs/target/checkstyle-result.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/docs/target/contents/reference/html/css/highlight.css b/docs/target/contents/reference/html/css/highlight.css
deleted file mode 100644
index ffefef72..00000000
--- a/docs/target/contents/reference/html/css/highlight.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- code highlight CSS resemblign the Eclipse IDE default color schema
- @author Costin Leau
-*/
-
-.hl-keyword {
- color: #7F0055;
- font-weight: bold;
-}
-
-.hl-comment {
- color: #3F5F5F;
- font-style: italic;
-}
-
-.hl-multiline-comment {
- color: #3F5FBF;
- font-style: italic;
-}
-
-.hl-tag {
- color: #3F7F7F;
-}
-
-.hl-attribute {
- color: #7F007F;
-}
-
-.hl-value {
- color: #2A00FF;
-}
-
-.hl-string {
- color: #2A00FF;
-}
\ No newline at end of file
diff --git a/docs/target/contents/reference/html/css/manual-multipage.css b/docs/target/contents/reference/html/css/manual-multipage.css
deleted file mode 100644
index 0c484531..00000000
--- a/docs/target/contents/reference/html/css/manual-multipage.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@IMPORT url("manual.css");
-
-body.firstpage {
- background: url("../images/background.png") no-repeat center top;
-}
-
-div.part h1 {
- border-top: none;
-}
diff --git a/docs/target/contents/reference/html/css/manual-singlepage.css b/docs/target/contents/reference/html/css/manual-singlepage.css
deleted file mode 100644
index 4a7fd140..00000000
--- a/docs/target/contents/reference/html/css/manual-singlepage.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@IMPORT url("manual.css");
-
-body {
- background: url("../images/background.png") no-repeat center top;
-}
-
diff --git a/docs/target/contents/reference/html/css/manual.css b/docs/target/contents/reference/html/css/manual.css
deleted file mode 100644
index 0ecbe2e8..00000000
--- a/docs/target/contents/reference/html/css/manual.css
+++ /dev/null
@@ -1,344 +0,0 @@
-@IMPORT url("highlight.css");
-
-html {
- padding: 0pt;
- margin: 0pt;
-}
-
-body {
- color: #333333;
- margin: 15px 30px;
- font-family: Helvetica, Arial, Freesans, Clean, Sans-serif;
- line-height: 1.6;
- -webkit-font-smoothing: antialiased;
-}
-
-code {
- font-size: 16px;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-:not(a)>code {
- color: #6D180B;
-}
-
-:not(pre)>code {
- background-color: #F2F2F2;
- border: 1px solid #CCCCCC;
- border-radius: 4px;
- padding: 1px 3px 0;
- text-shadow: none;
- white-space: nowrap;
-}
-
-body>*:first-child {
- margin-top: 0 !important;
-}
-
-div {
- margin: 0pt;
-}
-
-hr {
- border: 1px solid #CCCCCC;
- background: #CCCCCC;
-}
-
-h1,h2,h3,h4,h5,h6 {
- color: #000000;
- cursor: text;
- font-weight: bold;
- margin: 30px 0 10px;
- padding: 0;
-}
-
-h1,h2,h3 {
- margin: 40px 0 10px;
-}
-
-h1 {
- margin: 70px 0 30px;
- padding-top: 20px;
-}
-
-div.part h1 {
- border-top: 1px dotted #CCCCCC;
-}
-
-h1,h1 code {
- font-size: 32px;
-}
-
-h2,h2 code {
- font-size: 24px;
-}
-
-h3,h3 code {
- font-size: 20px;
-}
-
-h4,h1 code,h5,h5 code,h6,h6 code {
- font-size: 18px;
-}
-
-div.book,div.chapter,div.appendix,div.part,div.preface {
- min-width: 300px;
- max-width: 1200px;
- margin: 0 auto;
-}
-
-p.releaseinfo {
- font-weight: bold;
- margin-bottom: 40px;
- margin-top: 40px;
-}
-
-div.authorgroup {
- line-height: 1;
-}
-
-p.copyright {
- line-height: 1;
- margin-bottom: -5px;
-}
-
-.legalnotice p {
- font-style: italic;
- font-size: 14px;
- line-height: 1;
-}
-
-div.titlepage+p,div.titlepage+p {
- margin-top: 0;
-}
-
-pre {
- line-height: 1.0;
- color: black;
-}
-
-a {
- color: #4183C4;
- text-decoration: none;
-}
-
-p {
- margin: 15px 0;
- text-align: left;
-}
-
-ul,ol {
- padding-left: 30px;
-}
-
-li p {
- margin: 0;
-}
-
-div.table {
- margin: 1em;
- padding: 0.5em;
- text-align: center;
-}
-
-div.table table,div.informaltable table {
- display: table;
- width: 100%;
-}
-
-div.table td {
- padding-left: 7px;
- padding-right: 7px;
-}
-
-.sidebar {
- line-height: 1.4;
- padding: 0 20px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
-}
-
-.sidebar p.title {
- color: #6D180B;
-}
-
-pre.programlisting,pre.screen {
- font-size: 15px;
- padding: 6px 10px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
- clear: both;
- overflow: auto;
- line-height: 1.4;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
- border: 1px solid #DDDDDD !important;
- border-radius: 4px !important;
- border-collapse: separate !important;
- line-height: 1.6;
-}
-
-table thead {
- background: #F5F5F5;
-}
-
-table tr {
- border: none;
- border-bottom: none;
-}
-
-table th {
- font-weight: bold;
-}
-
-table th,table td {
- border: none !important;
- padding: 6px 13px;
-}
-
-table tr:nth-child(2n) {
- background-color: #F8F8F8;
-}
-
-td p {
- margin: 0 0 15px 0;
-}
-
-div.table-contents td p {
- margin: 0;
-}
-
-div.important *,div.note *,div.tip *,div.warning *,div.navheader *,div.navfooter *,div.calloutlist *
- {
- border: none !important;
- background: none !important;
- margin: 0;
-}
-
-div.important p,div.note p,div.tip p,div.warning p {
- color: #6F6F6F;
- line-height: 1.6;
-}
-
-div.important code,div.note code,div.tip code,div.warning code {
- background-color: #F2F2F2 !important;
- border: 1px solid #CCCCCC !important;
- border-radius: 4px !important;
- padding: 1px 3px 0 !important;
- text-shadow: none !important;
- white-space: nowrap !important;
-}
-
-.note th,.tip th,.warning th {
- display: none;
-}
-
-.note tr:first-child td,.tip tr:first-child td,.warning tr:first-child td
- {
- border-right: 1px solid #CCCCCC !important;
- padding-top: 10px;
-}
-
-div.calloutlist p,div.calloutlist td {
- padding: 0;
- margin: 0;
-}
-
-div.calloutlist>table>tbody>tr>td:first-child {
- padding-left: 10px;
- width: 30px !important;
-}
-
-div.important,div.note,div.tip,div.warning {
- margin-left: 0px !important;
- margin-right: 20px !important;
- margin-top: 20px;
- margin-bottom: 20px;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-div.toc {
- line-height: 1.2;
-}
-
-dl,dt {
- margin-top: 1px;
- margin-bottom: 0;
-}
-
-div.toc>dl>dt {
- font-size: 32px;
- font-weight: bold;
- margin: 30px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dt {
- font-size: 24px;
- font-weight: bold;
- margin: 20px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dd>dl>dt {
- font-weight: bold;
- font-size: 20px;
- margin: 10px 0 0 0;
-}
-
-tbody.footnotes * {
- border: none !important;
-}
-
-div.footnote p {
- margin: 0;
- line-height: 1;
-}
-
-div.footnote p sup {
- margin-right: 6px;
- vertical-align: middle;
-}
-
-div.navheader {
- border-bottom: 1px solid #CCCCCC;
-}
-
-div.navfooter {
- border-top: 1px solid #CCCCCC;
-}
-
-.title {
- margin-left: -1em;
- padding-left: 1em;
-}
-
-.title>a {
- position: absolute;
- visibility: hidden;
- display: block;
- font-size: 0.85em;
- margin-top: 0.05em;
- margin-left: -1em;
- vertical-align: text-top;
- color: black;
-}
-
-.title>a:before {
- content: "\00A7";
-}
-
-.title:hover>a,.title>a:hover,.title:hover>a:hover {
- visibility: visible;
-}
-
-.title:focus>a,.title>a:focus,.title:focus>a:focus {
- outline: 0;
-}
diff --git a/docs/target/contents/reference/html/images/background.png b/docs/target/contents/reference/html/images/background.png
deleted file mode 100644
index 15dca6fb..00000000
Binary files a/docs/target/contents/reference/html/images/background.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/caution.png b/docs/target/contents/reference/html/images/caution.png
deleted file mode 100644
index 8a5e4fca..00000000
Binary files a/docs/target/contents/reference/html/images/caution.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/important.png b/docs/target/contents/reference/html/images/important.png
deleted file mode 100644
index ec54df65..00000000
Binary files a/docs/target/contents/reference/html/images/important.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/logo.png b/docs/target/contents/reference/html/images/logo.png
deleted file mode 100644
index ade2ce6e..00000000
Binary files a/docs/target/contents/reference/html/images/logo.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/note.png b/docs/target/contents/reference/html/images/note.png
deleted file mode 100644
index 88d997b1..00000000
Binary files a/docs/target/contents/reference/html/images/note.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/sts_exception.png b/docs/target/contents/reference/html/images/sts_exception.png
deleted file mode 100644
index 8607c38a..00000000
Binary files a/docs/target/contents/reference/html/images/sts_exception.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/tip.png b/docs/target/contents/reference/html/images/tip.png
deleted file mode 100644
index 6530abb4..00000000
Binary files a/docs/target/contents/reference/html/images/tip.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/warning.png b/docs/target/contents/reference/html/images/warning.png
deleted file mode 100644
index 0d5b5244..00000000
Binary files a/docs/target/contents/reference/html/images/warning.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/images/web-selected.png b/docs/target/contents/reference/html/images/web-selected.png
deleted file mode 100644
index aa6b2da6..00000000
Binary files a/docs/target/contents/reference/html/images/web-selected.png and /dev/null differ
diff --git a/docs/target/contents/reference/html/multi__spring_cloud_commons_common_abstractions.html b/docs/target/contents/reference/html/multi__spring_cloud_commons_common_abstractions.html
deleted file mode 100644
index dd831115..00000000
--- a/docs/target/contents/reference/html/multi__spring_cloud_commons_common_abstractions.html
+++ /dev/null
@@ -1,107 +0,0 @@
-
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/contents/reference/html/multi__spring_cloud_context_application_context_services.html b/docs/target/contents/reference/html/multi__spring_cloud_context_application_context_services.html
deleted file mode 100644
index cdbb4381..00000000
--- a/docs/target/contents/reference/html/multi__spring_cloud_context_application_context_services.html
+++ /dev/null
@@ -1,190 +0,0 @@
-
-
- 1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
\ No newline at end of file
diff --git a/docs/target/contents/reference/html/multi_spring-cloud-commons.html b/docs/target/contents/reference/html/multi_spring-cloud-commons.html
deleted file mode 100644
index 95bbb5c3..00000000
--- a/docs/target/contents/reference/html/multi_spring-cloud-commons.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
- Cloud Native Applications
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
1.10 Endpoints
For a Spring Boot Actuator application there are some additional management endpoints:
POST to /env to update the Environment and rebind @ConfigurationProperties and log levels
/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans
/restart for closing the ApplicationContext and restarting it (disabled by default)
/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)
2. Spring Cloud Commons: Common Abstractions
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/docbook/html/multi__spring_cloud_commons_common_abstractions.html b/docs/target/docbook/html/multi__spring_cloud_commons_common_abstractions.html
deleted file mode 100644
index dd831115..00000000
--- a/docs/target/docbook/html/multi__spring_cloud_commons_common_abstractions.html
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
- 2. Spring Cloud Commons: Common Abstractions
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/docbook/html/multi__spring_cloud_context_application_context_services.html b/docs/target/docbook/html/multi__spring_cloud_context_application_context_services.html
deleted file mode 100644
index cdbb4381..00000000
--- a/docs/target/docbook/html/multi__spring_cloud_context_application_context_services.html
+++ /dev/null
@@ -1,190 +0,0 @@
-
-
- 1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
\ No newline at end of file
diff --git a/docs/target/docbook/html/multi_spring-cloud-commons.html b/docs/target/docbook/html/multi_spring-cloud-commons.html
deleted file mode 100644
index 95bbb5c3..00000000
--- a/docs/target/docbook/html/multi_spring-cloud-commons.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
- Cloud Native Applications
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
1.10 Endpoints
For a Spring Boot Actuator application there are some additional management endpoints:
POST to /env to update the Environment and rebind @ConfigurationProperties and log levels
/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans
/restart for closing the ApplicationContext and restarting it (disabled by default)
/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)
2. Spring Cloud Commons: Common Abstractions
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/generated-docs/antrun/build-main.xml b/docs/target/generated-docs/antrun/build-main.xml
deleted file mode 100644
index 8086f804..00000000
--- a/docs/target/generated-docs/antrun/build-main.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- :nofooter:
-:linkcss:
-:stylesdir: css
-:stylesheet: manual-singlepage.css
-
-= {docs-main}
-
-{spring-cloud-version}
-
-== Pick The Documentation Option
-
-- link:single/{docs-main}.html[Single HTML]
-- link:multi/{docs-main}.html[Multi HTML]
-
-
\ No newline at end of file
diff --git a/docs/target/generated-docs/checkstyle-cachefile b/docs/target/generated-docs/checkstyle-cachefile
deleted file mode 100644
index 2c720025..00000000
--- a/docs/target/generated-docs/checkstyle-cachefile
+++ /dev/null
@@ -1,2 +0,0 @@
-#Tue Aug 29 11:13:03 UTC 2017
-configuration*?=DDAFDE728981B5AF5B26FADDDDE6B592442900FA
diff --git a/docs/target/generated-docs/checkstyle-checker.xml b/docs/target/generated-docs/checkstyle-checker.xml
deleted file mode 100644
index 79233ddb..00000000
--- a/docs/target/generated-docs/checkstyle-checker.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/target/generated-docs/checkstyle-header.txt b/docs/target/generated-docs/checkstyle-header.txt
deleted file mode 100644
index d6456956..00000000
--- a/docs/target/generated-docs/checkstyle-header.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/docs/target/generated-docs/checkstyle-result.xml b/docs/target/generated-docs/checkstyle-result.xml
deleted file mode 100644
index 472022e4..00000000
--- a/docs/target/generated-docs/checkstyle-result.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/docs/target/generated-docs/css/highlight.css b/docs/target/generated-docs/css/highlight.css
deleted file mode 100644
index ffefef72..00000000
--- a/docs/target/generated-docs/css/highlight.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- code highlight CSS resemblign the Eclipse IDE default color schema
- @author Costin Leau
-*/
-
-.hl-keyword {
- color: #7F0055;
- font-weight: bold;
-}
-
-.hl-comment {
- color: #3F5F5F;
- font-style: italic;
-}
-
-.hl-multiline-comment {
- color: #3F5FBF;
- font-style: italic;
-}
-
-.hl-tag {
- color: #3F7F7F;
-}
-
-.hl-attribute {
- color: #7F007F;
-}
-
-.hl-value {
- color: #2A00FF;
-}
-
-.hl-string {
- color: #2A00FF;
-}
\ No newline at end of file
diff --git a/docs/target/generated-docs/css/manual-multipage.css b/docs/target/generated-docs/css/manual-multipage.css
deleted file mode 100644
index 0c484531..00000000
--- a/docs/target/generated-docs/css/manual-multipage.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@IMPORT url("manual.css");
-
-body.firstpage {
- background: url("../images/background.png") no-repeat center top;
-}
-
-div.part h1 {
- border-top: none;
-}
diff --git a/docs/target/generated-docs/css/manual-singlepage.css b/docs/target/generated-docs/css/manual-singlepage.css
deleted file mode 100644
index 4a7fd140..00000000
--- a/docs/target/generated-docs/css/manual-singlepage.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@IMPORT url("manual.css");
-
-body {
- background: url("../images/background.png") no-repeat center top;
-}
-
diff --git a/docs/target/generated-docs/css/manual.css b/docs/target/generated-docs/css/manual.css
deleted file mode 100644
index 0ecbe2e8..00000000
--- a/docs/target/generated-docs/css/manual.css
+++ /dev/null
@@ -1,344 +0,0 @@
-@IMPORT url("highlight.css");
-
-html {
- padding: 0pt;
- margin: 0pt;
-}
-
-body {
- color: #333333;
- margin: 15px 30px;
- font-family: Helvetica, Arial, Freesans, Clean, Sans-serif;
- line-height: 1.6;
- -webkit-font-smoothing: antialiased;
-}
-
-code {
- font-size: 16px;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-:not(a)>code {
- color: #6D180B;
-}
-
-:not(pre)>code {
- background-color: #F2F2F2;
- border: 1px solid #CCCCCC;
- border-radius: 4px;
- padding: 1px 3px 0;
- text-shadow: none;
- white-space: nowrap;
-}
-
-body>*:first-child {
- margin-top: 0 !important;
-}
-
-div {
- margin: 0pt;
-}
-
-hr {
- border: 1px solid #CCCCCC;
- background: #CCCCCC;
-}
-
-h1,h2,h3,h4,h5,h6 {
- color: #000000;
- cursor: text;
- font-weight: bold;
- margin: 30px 0 10px;
- padding: 0;
-}
-
-h1,h2,h3 {
- margin: 40px 0 10px;
-}
-
-h1 {
- margin: 70px 0 30px;
- padding-top: 20px;
-}
-
-div.part h1 {
- border-top: 1px dotted #CCCCCC;
-}
-
-h1,h1 code {
- font-size: 32px;
-}
-
-h2,h2 code {
- font-size: 24px;
-}
-
-h3,h3 code {
- font-size: 20px;
-}
-
-h4,h1 code,h5,h5 code,h6,h6 code {
- font-size: 18px;
-}
-
-div.book,div.chapter,div.appendix,div.part,div.preface {
- min-width: 300px;
- max-width: 1200px;
- margin: 0 auto;
-}
-
-p.releaseinfo {
- font-weight: bold;
- margin-bottom: 40px;
- margin-top: 40px;
-}
-
-div.authorgroup {
- line-height: 1;
-}
-
-p.copyright {
- line-height: 1;
- margin-bottom: -5px;
-}
-
-.legalnotice p {
- font-style: italic;
- font-size: 14px;
- line-height: 1;
-}
-
-div.titlepage+p,div.titlepage+p {
- margin-top: 0;
-}
-
-pre {
- line-height: 1.0;
- color: black;
-}
-
-a {
- color: #4183C4;
- text-decoration: none;
-}
-
-p {
- margin: 15px 0;
- text-align: left;
-}
-
-ul,ol {
- padding-left: 30px;
-}
-
-li p {
- margin: 0;
-}
-
-div.table {
- margin: 1em;
- padding: 0.5em;
- text-align: center;
-}
-
-div.table table,div.informaltable table {
- display: table;
- width: 100%;
-}
-
-div.table td {
- padding-left: 7px;
- padding-right: 7px;
-}
-
-.sidebar {
- line-height: 1.4;
- padding: 0 20px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
-}
-
-.sidebar p.title {
- color: #6D180B;
-}
-
-pre.programlisting,pre.screen {
- font-size: 15px;
- padding: 6px 10px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
- clear: both;
- overflow: auto;
- line-height: 1.4;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
- border: 1px solid #DDDDDD !important;
- border-radius: 4px !important;
- border-collapse: separate !important;
- line-height: 1.6;
-}
-
-table thead {
- background: #F5F5F5;
-}
-
-table tr {
- border: none;
- border-bottom: none;
-}
-
-table th {
- font-weight: bold;
-}
-
-table th,table td {
- border: none !important;
- padding: 6px 13px;
-}
-
-table tr:nth-child(2n) {
- background-color: #F8F8F8;
-}
-
-td p {
- margin: 0 0 15px 0;
-}
-
-div.table-contents td p {
- margin: 0;
-}
-
-div.important *,div.note *,div.tip *,div.warning *,div.navheader *,div.navfooter *,div.calloutlist *
- {
- border: none !important;
- background: none !important;
- margin: 0;
-}
-
-div.important p,div.note p,div.tip p,div.warning p {
- color: #6F6F6F;
- line-height: 1.6;
-}
-
-div.important code,div.note code,div.tip code,div.warning code {
- background-color: #F2F2F2 !important;
- border: 1px solid #CCCCCC !important;
- border-radius: 4px !important;
- padding: 1px 3px 0 !important;
- text-shadow: none !important;
- white-space: nowrap !important;
-}
-
-.note th,.tip th,.warning th {
- display: none;
-}
-
-.note tr:first-child td,.tip tr:first-child td,.warning tr:first-child td
- {
- border-right: 1px solid #CCCCCC !important;
- padding-top: 10px;
-}
-
-div.calloutlist p,div.calloutlist td {
- padding: 0;
- margin: 0;
-}
-
-div.calloutlist>table>tbody>tr>td:first-child {
- padding-left: 10px;
- width: 30px !important;
-}
-
-div.important,div.note,div.tip,div.warning {
- margin-left: 0px !important;
- margin-right: 20px !important;
- margin-top: 20px;
- margin-bottom: 20px;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-div.toc {
- line-height: 1.2;
-}
-
-dl,dt {
- margin-top: 1px;
- margin-bottom: 0;
-}
-
-div.toc>dl>dt {
- font-size: 32px;
- font-weight: bold;
- margin: 30px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dt {
- font-size: 24px;
- font-weight: bold;
- margin: 20px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dd>dl>dt {
- font-weight: bold;
- font-size: 20px;
- margin: 10px 0 0 0;
-}
-
-tbody.footnotes * {
- border: none !important;
-}
-
-div.footnote p {
- margin: 0;
- line-height: 1;
-}
-
-div.footnote p sup {
- margin-right: 6px;
- vertical-align: middle;
-}
-
-div.navheader {
- border-bottom: 1px solid #CCCCCC;
-}
-
-div.navfooter {
- border-top: 1px solid #CCCCCC;
-}
-
-.title {
- margin-left: -1em;
- padding-left: 1em;
-}
-
-.title>a {
- position: absolute;
- visibility: hidden;
- display: block;
- font-size: 0.85em;
- margin-top: 0.05em;
- margin-left: -1em;
- vertical-align: text-top;
- color: black;
-}
-
-.title>a:before {
- content: "\00A7";
-}
-
-.title:hover>a,.title>a:hover,.title:hover>a:hover {
- visibility: visible;
-}
-
-.title:focus>a,.title>a:focus,.title:focus>a:focus {
- outline: 0;
-}
diff --git a/docs/target/generated-docs/ghpages.sh b/docs/target/generated-docs/ghpages.sh
deleted file mode 100644
index 57c5da3a..00000000
--- a/docs/target/generated-docs/ghpages.sh
+++ /dev/null
@@ -1,330 +0,0 @@
-#!/bin/bash -x
-
-set -e
-
-# Set default props like MAVEN_PATH, ROOT_FOLDER etc.
-function set_default_props() {
- # The script should be executed from the root folder
- ROOT_FOLDER=`pwd`
- echo "Current folder is ${ROOT_FOLDER}"
-
- if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
- echo "You're not in the root folder of the project!"
- exit 1
- fi
-
- # Prop that will let commit the changes
- COMMIT_CHANGES="no"
- MAVEN_PATH=${MAVEN_PATH:-}
- echo "Path to Maven is [${MAVEN_PATH}]"
- REPO_NAME=${PWD##*/}
- echo "Repo name is [${REPO_NAME}]"
- SPRING_CLOUD_STATIC_REPO=${SPRING_CLOUD_STATIC_REPO:-git@github.com:spring-cloud/spring-cloud-static.git}
- echo "Spring Cloud Static repo is [${SPRING_CLOUD_STATIC_REPO}"
-}
-
-# Check if gh-pages exists and docs have been built
-function check_if_anything_to_sync() {
- git remote set-url --push origin `git config remote.origin.url | sed -e 's/^git:/https:/'`
-
- if ! (git remote set-branches --add origin gh-pages && git fetch -q); then
- echo "No gh-pages, so not syncing"
- exit 0
- fi
-
- if ! [ -d docs/target/generated-docs ] && ! [ "${BUILD}" == "yes" ]; then
- echo "No gh-pages sources in docs/target/generated-docs, so not syncing"
- exit 0
- fi
-}
-
-function retrieve_current_branch() {
- # Code getting the name of the current branch. For master we want to publish as we did until now
- # http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
- # If there is a branch already passed will reuse it - otherwise will try to find it
- CURRENT_BRANCH=${BRANCH}
- if [[ -z "${CURRENT_BRANCH}" ]] ; then
- CURRENT_BRANCH=$(git symbolic-ref -q HEAD)
- CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/}
- CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD}
- fi
- echo "Current branch is [${CURRENT_BRANCH}]"
- git checkout ${CURRENT_BRANCH} || echo "Failed to check the branch... continuing with the script"
-}
-
-# Switches to the provided value of the release version. We always prefix it with `v`
-function switch_to_tag() {
- git checkout v${VERSION}
-}
-
-# Build the docs if switch is on
-function build_docs_if_applicable() {
- if [[ "${BUILD}" == "yes" ]] ; then
- ./mvnw clean install -P docs -pl docs -DskipTests
- fi
-}
-
-# Get the name of the `docs.main` property
-# Get whitelisted branches - assumes that a `docs` module is available under `docs` profile
-function retrieve_doc_properties() {
- MAIN_ADOC_VALUE=$("${MAVEN_PATH}"mvn -q \
- -Dexec.executable="echo" \
- -Dexec.args='${docs.main}' \
- --non-recursive \
- org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
- echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
-
-
- WHITELIST_PROPERTY=${WHITELIST_PROPERTY:-"docs.whitelisted.branches"}
- WHITELISTED_BRANCHES_VALUE=$("${MAVEN_PATH}"mvn -q \
- -Dexec.executable="echo" \
- -Dexec.args="\${${WHITELIST_PROPERTY}}" \
- org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
- -P docs \
- -pl docs)
- echo "Extracted '${WHITELIST_PROPERTY}' from Maven build [${WHITELISTED_BRANCHES_VALUE}]"
-}
-
-# Stash any outstanding changes
-function stash_changes() {
- git diff-index --quiet HEAD && dirty=$? || (echo "Failed to check if the current repo is dirty. Assuming that it is." && dirty="1")
- if [ "$dirty" != "0" ]; then git stash; fi
-}
-
-# Switch to gh-pages branch to sync it with current branch
-function add_docs_from_target() {
- local DESTINATION_REPO_FOLDER
- if [[ -z "${DESTINATION}" && -z "${CLONE}" ]] ; then
- DESTINATION_REPO_FOLDER=${ROOT_FOLDER}
- elif [[ "${CLONE}" == "yes" ]]; then
- mkdir -p ${ROOT_FOLDER}/target
- local clonedStatic=${ROOT_FOLDER}/target/spring-cloud-static
- if [[ ! -e "${clonedStatic}/.git" ]]; then
- echo "Cloning Spring Cloud Static to target"
- git clone ${SPRING_CLOUD_STATIC_REPO} ${clonedStatic} && git checkout gh-pages
- else
- echo "Spring Cloud Static already cloned - will pull changes"
- cd ${clonedStatic} && git checkout gh-pages && git pull origin gh-pages
- fi
- DESTINATION_REPO_FOLDER=${clonedStatic}/${REPO_NAME}
- mkdir -p ${DESTINATION_REPO_FOLDER}
- else
- if [[ ! -e "${DESTINATION}/.git" ]]; then
- echo "[${DESTINATION}] is not a git repository"
- exit 1
- fi
- DESTINATION_REPO_FOLDER=${DESTINATION}/${REPO_NAME}
- mkdir -p ${DESTINATION_REPO_FOLDER}
- echo "Destination was provided [${DESTINATION}]"
- fi
- cd ${DESTINATION_REPO_FOLDER}
- git checkout gh-pages
- git pull origin gh-pages
-
- # Add git branches
- ###################################################################
- if [[ -z "${VERSION}" ]] ; then
- copy_docs_for_current_version
- else
- copy_docs_for_provided_version
- fi
- commit_changes_if_applicable
-}
-
-
-# Copies the docs by using the retrieved properties from Maven build
-function copy_docs_for_current_version() {
- if [[ "${CURRENT_BRANCH}" == "master" ]] ; then
- echo -e "Current branch is master - will copy the current docs only to the root folder"
- for f in docs/target/generated-docs/*; do
- file=${f#docs/target/generated-docs/*}
- if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
- # Not ignored...
- cp -rf $f ${ROOT_FOLDER}/
- git add -A ${ROOT_FOLDER}/$file
- fi
- done
- COMMIT_CHANGES="yes"
- else
- echo -e "Current branch is [${CURRENT_BRANCH}]"
- # http://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin
- if [[ ",${WHITELISTED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then
- mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH}
- echo -e "Branch [${CURRENT_BRANCH}] is whitelisted! Will copy the current docs to the [${CURRENT_BRANCH}] folder"
- for f in docs/target/generated-docs/*; do
- file=${f#docs/target/generated-docs/*}
- if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
- # Not ignored...
- # We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
- if [[ "${file}" == "${MAIN_ADOC_VALUE}.html" ]] ; then
- # We don't want to copy the spring-cloud-sleuth.html
- # we want it to be converted to index.html
- cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
- git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
- else
- cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}
- git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/$file
- fi
- fi
- done
- COMMIT_CHANGES="yes"
- else
- echo -e "Branch [${CURRENT_BRANCH}] is not on the white list! Check out the Maven [${WHITELIST_PROPERTY}] property in
- [docs] module available under [docs] profile. Won't commit any changes to gh-pages for this branch."
- fi
- fi
-}
-
-# Copies the docs by using the explicitly provided version
-function copy_docs_for_provided_version() {
- local FOLDER=${DESTINATION_REPO_FOLDER}/${VERSION}
- mkdir -p ${FOLDER}
- echo -e "Current tag is [v${VERSION}] Will copy the current docs to the [${FOLDER}] folder"
- for f in ${ROOT_FOLDER}/docs/target/generated-docs/*; do
- file=${f#${ROOT_FOLDER}/docs/target/generated-docs/*}
- copy_docs_for_branch ${file} ${FOLDER}
- done
- COMMIT_CHANGES="yes"
- CURRENT_BRANCH="v${VERSION}"
-}
-
-# Copies the docs from target to the provided destination
-# Params:
-# $1 - file from target
-# $2 - destination to which copy the files
-function copy_docs_for_branch() {
- local file=$1
- local destination=$2
- if ! git ls-files -i -o --exclude-standard --directory | grep -q ^${file}$; then
- # Not ignored...
- # We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
- if [[ ("${file}" == "${MAIN_ADOC_VALUE}.html") || ("${file}" == "${REPO_NAME}.html") ]] ; then
- # We don't want to copy the spring-cloud-sleuth.html
- # we want it to be converted to index.html
- cp -rf $f ${destination}/index.html
- git add -A ${destination}/index.html
- else
- cp -rf $f ${destination}
- git add -A ${destination}/$file
- fi
- fi
-}
-
-function commit_changes_if_applicable() {
- if [[ "${COMMIT_CHANGES}" == "yes" ]] ; then
- COMMIT_SUCCESSFUL="no"
- git commit -a -m "Sync docs from ${CURRENT_BRANCH} to gh-pages" && COMMIT_SUCCESSFUL="yes" || echo "Failed to commit changes"
-
- # Uncomment the following push if you want to auto push to
- # the gh-pages branch whenever you commit to master locally.
- # This is a little extreme. Use with care!
- ###################################################################
- if [[ "${COMMIT_SUCCESSFUL}" == "yes" ]] ; then
- git push origin gh-pages
- fi
- fi
-}
-
-# Switch back to the previous branch and exit block
-function checkout_previous_branch() {
- # If -version was provided we need to come back to root project
- cd ${ROOT_FOLDER}
- git checkout ${CURRENT_BRANCH} || echo "Failed to check the branch... continuing with the script"
- if [ "$dirty" != "0" ]; then git stash pop; fi
- exit 0
-}
-
-# Assert if properties have been properly passed
-function assert_properties() {
-echo "VERSION [${VERSION}], DESTINATION [${DESTINATION}], CLONE [${CLONE}]"
-if [[ "${VERSION}" != "" && (-z "${DESTINATION}" && -z "${CLONE}") ]] ; then echo "Version was set but destination / clone was not!"; exit 1;fi
-if [[ ("${DESTINATION}" != "" && "${CLONE}" != "") && -z "${VERSION}" ]] ; then echo "Destination / clone was set but version was not!"; exit 1;fi
-if [[ "${DESTINATION}" != "" && "${CLONE}" == "yes" ]] ; then echo "Destination and clone was set. Pick one!"; exit 1;fi
-}
-
-# Prints the usage
-function print_usage() {
-cat </`
-- if the destination switch is passed (-d) then the script will check if the provided dir is a git repo and then will
- switch to gh-pages of that repo and copy the generated docs to `docs//`
-
-USAGE:
-
-You can use the following options:
-
--v|--version - the script will apply the whole procedure for a particular library version
--d|--destination - the root of destination folder where the docs should be copied. You have to use the full path.
- E.g. point to spring-cloud-static folder. Can't be used with (-c)
--b|--build - will run the standard build process after checking out the branch
--c|--clone - will automatically clone the spring-cloud-static repo instead of providing the destination.
- Obviously can't be used with (-d)
-
-EOF
-}
-
-
-# ==========================================
-# ____ ____ _____ _____ _____ _______
-# / ____|/ ____| __ \|_ _| __ \__ __|
-# | (___ | | | |__) | | | | |__) | | |
-# \___ \| | | _ / | | | ___/ | |
-# ____) | |____| | \ \ _| |_| | | |
-# |_____/ \_____|_| \_\_____|_| |_|
-#
-# ==========================================
-
-while [[ $# > 0 ]]
-do
-key="$1"
-case ${key} in
- -v|--version)
- VERSION="$2"
- shift # past argument
- ;;
- -d|--destination)
- DESTINATION="$2"
- shift # past argument
- ;;
- -b|--build)
- BUILD="yes"
- ;;
- -c|--clone)
- CLONE="yes"
- ;;
- -h|--help)
- print_usage
- exit 0
- ;;
- *)
- echo "Invalid option: [$1]"
- print_usage
- exit 1
- ;;
-esac
-shift # past argument or value
-done
-
-assert_properties
-set_default_props
-check_if_anything_to_sync
-if [[ -z "${VERSION}" ]] ; then
- retrieve_current_branch
-else
- switch_to_tag
-fi
-build_docs_if_applicable
-retrieve_doc_properties
-stash_changes
-add_docs_from_target
-checkout_previous_branch
\ No newline at end of file
diff --git a/docs/target/generated-docs/images/background.png b/docs/target/generated-docs/images/background.png
deleted file mode 100644
index 15dca6fb..00000000
Binary files a/docs/target/generated-docs/images/background.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/caution.png b/docs/target/generated-docs/images/caution.png
deleted file mode 100644
index 8a5e4fca..00000000
Binary files a/docs/target/generated-docs/images/caution.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/important.png b/docs/target/generated-docs/images/important.png
deleted file mode 100644
index ec54df65..00000000
Binary files a/docs/target/generated-docs/images/important.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/logo.png b/docs/target/generated-docs/images/logo.png
deleted file mode 100644
index ade2ce6e..00000000
Binary files a/docs/target/generated-docs/images/logo.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/note.png b/docs/target/generated-docs/images/note.png
deleted file mode 100644
index 88d997b1..00000000
Binary files a/docs/target/generated-docs/images/note.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/sts_exception.png b/docs/target/generated-docs/images/sts_exception.png
deleted file mode 100644
index 8607c38a..00000000
Binary files a/docs/target/generated-docs/images/sts_exception.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/tip.png b/docs/target/generated-docs/images/tip.png
deleted file mode 100644
index 6530abb4..00000000
Binary files a/docs/target/generated-docs/images/tip.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/warning.png b/docs/target/generated-docs/images/warning.png
deleted file mode 100644
index 0d5b5244..00000000
Binary files a/docs/target/generated-docs/images/warning.png and /dev/null differ
diff --git a/docs/target/generated-docs/images/web-selected.png b/docs/target/generated-docs/images/web-selected.png
deleted file mode 100644
index aa6b2da6..00000000
Binary files a/docs/target/generated-docs/images/web-selected.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/css/highlight.css b/docs/target/generated-docs/multi/css/highlight.css
deleted file mode 100644
index ffefef72..00000000
--- a/docs/target/generated-docs/multi/css/highlight.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- code highlight CSS resemblign the Eclipse IDE default color schema
- @author Costin Leau
-*/
-
-.hl-keyword {
- color: #7F0055;
- font-weight: bold;
-}
-
-.hl-comment {
- color: #3F5F5F;
- font-style: italic;
-}
-
-.hl-multiline-comment {
- color: #3F5FBF;
- font-style: italic;
-}
-
-.hl-tag {
- color: #3F7F7F;
-}
-
-.hl-attribute {
- color: #7F007F;
-}
-
-.hl-value {
- color: #2A00FF;
-}
-
-.hl-string {
- color: #2A00FF;
-}
\ No newline at end of file
diff --git a/docs/target/generated-docs/multi/css/manual-multipage.css b/docs/target/generated-docs/multi/css/manual-multipage.css
deleted file mode 100644
index 0c484531..00000000
--- a/docs/target/generated-docs/multi/css/manual-multipage.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@IMPORT url("manual.css");
-
-body.firstpage {
- background: url("../images/background.png") no-repeat center top;
-}
-
-div.part h1 {
- border-top: none;
-}
diff --git a/docs/target/generated-docs/multi/css/manual-singlepage.css b/docs/target/generated-docs/multi/css/manual-singlepage.css
deleted file mode 100644
index 4a7fd140..00000000
--- a/docs/target/generated-docs/multi/css/manual-singlepage.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@IMPORT url("manual.css");
-
-body {
- background: url("../images/background.png") no-repeat center top;
-}
-
diff --git a/docs/target/generated-docs/multi/css/manual.css b/docs/target/generated-docs/multi/css/manual.css
deleted file mode 100644
index 0ecbe2e8..00000000
--- a/docs/target/generated-docs/multi/css/manual.css
+++ /dev/null
@@ -1,344 +0,0 @@
-@IMPORT url("highlight.css");
-
-html {
- padding: 0pt;
- margin: 0pt;
-}
-
-body {
- color: #333333;
- margin: 15px 30px;
- font-family: Helvetica, Arial, Freesans, Clean, Sans-serif;
- line-height: 1.6;
- -webkit-font-smoothing: antialiased;
-}
-
-code {
- font-size: 16px;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-:not(a)>code {
- color: #6D180B;
-}
-
-:not(pre)>code {
- background-color: #F2F2F2;
- border: 1px solid #CCCCCC;
- border-radius: 4px;
- padding: 1px 3px 0;
- text-shadow: none;
- white-space: nowrap;
-}
-
-body>*:first-child {
- margin-top: 0 !important;
-}
-
-div {
- margin: 0pt;
-}
-
-hr {
- border: 1px solid #CCCCCC;
- background: #CCCCCC;
-}
-
-h1,h2,h3,h4,h5,h6 {
- color: #000000;
- cursor: text;
- font-weight: bold;
- margin: 30px 0 10px;
- padding: 0;
-}
-
-h1,h2,h3 {
- margin: 40px 0 10px;
-}
-
-h1 {
- margin: 70px 0 30px;
- padding-top: 20px;
-}
-
-div.part h1 {
- border-top: 1px dotted #CCCCCC;
-}
-
-h1,h1 code {
- font-size: 32px;
-}
-
-h2,h2 code {
- font-size: 24px;
-}
-
-h3,h3 code {
- font-size: 20px;
-}
-
-h4,h1 code,h5,h5 code,h6,h6 code {
- font-size: 18px;
-}
-
-div.book,div.chapter,div.appendix,div.part,div.preface {
- min-width: 300px;
- max-width: 1200px;
- margin: 0 auto;
-}
-
-p.releaseinfo {
- font-weight: bold;
- margin-bottom: 40px;
- margin-top: 40px;
-}
-
-div.authorgroup {
- line-height: 1;
-}
-
-p.copyright {
- line-height: 1;
- margin-bottom: -5px;
-}
-
-.legalnotice p {
- font-style: italic;
- font-size: 14px;
- line-height: 1;
-}
-
-div.titlepage+p,div.titlepage+p {
- margin-top: 0;
-}
-
-pre {
- line-height: 1.0;
- color: black;
-}
-
-a {
- color: #4183C4;
- text-decoration: none;
-}
-
-p {
- margin: 15px 0;
- text-align: left;
-}
-
-ul,ol {
- padding-left: 30px;
-}
-
-li p {
- margin: 0;
-}
-
-div.table {
- margin: 1em;
- padding: 0.5em;
- text-align: center;
-}
-
-div.table table,div.informaltable table {
- display: table;
- width: 100%;
-}
-
-div.table td {
- padding-left: 7px;
- padding-right: 7px;
-}
-
-.sidebar {
- line-height: 1.4;
- padding: 0 20px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
-}
-
-.sidebar p.title {
- color: #6D180B;
-}
-
-pre.programlisting,pre.screen {
- font-size: 15px;
- padding: 6px 10px;
- background-color: #F8F8F8;
- border: 1px solid #CCCCCC;
- border-radius: 3px 3px 3px 3px;
- clear: both;
- overflow: auto;
- line-height: 1.4;
- font-family: Consolas, "Liberation Mono", Courier, monospace;
-}
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
- border: 1px solid #DDDDDD !important;
- border-radius: 4px !important;
- border-collapse: separate !important;
- line-height: 1.6;
-}
-
-table thead {
- background: #F5F5F5;
-}
-
-table tr {
- border: none;
- border-bottom: none;
-}
-
-table th {
- font-weight: bold;
-}
-
-table th,table td {
- border: none !important;
- padding: 6px 13px;
-}
-
-table tr:nth-child(2n) {
- background-color: #F8F8F8;
-}
-
-td p {
- margin: 0 0 15px 0;
-}
-
-div.table-contents td p {
- margin: 0;
-}
-
-div.important *,div.note *,div.tip *,div.warning *,div.navheader *,div.navfooter *,div.calloutlist *
- {
- border: none !important;
- background: none !important;
- margin: 0;
-}
-
-div.important p,div.note p,div.tip p,div.warning p {
- color: #6F6F6F;
- line-height: 1.6;
-}
-
-div.important code,div.note code,div.tip code,div.warning code {
- background-color: #F2F2F2 !important;
- border: 1px solid #CCCCCC !important;
- border-radius: 4px !important;
- padding: 1px 3px 0 !important;
- text-shadow: none !important;
- white-space: nowrap !important;
-}
-
-.note th,.tip th,.warning th {
- display: none;
-}
-
-.note tr:first-child td,.tip tr:first-child td,.warning tr:first-child td
- {
- border-right: 1px solid #CCCCCC !important;
- padding-top: 10px;
-}
-
-div.calloutlist p,div.calloutlist td {
- padding: 0;
- margin: 0;
-}
-
-div.calloutlist>table>tbody>tr>td:first-child {
- padding-left: 10px;
- width: 30px !important;
-}
-
-div.important,div.note,div.tip,div.warning {
- margin-left: 0px !important;
- margin-right: 20px !important;
- margin-top: 20px;
- margin-bottom: 20px;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-div.toc {
- line-height: 1.2;
-}
-
-dl,dt {
- margin-top: 1px;
- margin-bottom: 0;
-}
-
-div.toc>dl>dt {
- font-size: 32px;
- font-weight: bold;
- margin: 30px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dt {
- font-size: 24px;
- font-weight: bold;
- margin: 20px 0 10px 0;
- display: block;
-}
-
-div.toc>dl>dd>dl>dd>dl>dt {
- font-weight: bold;
- font-size: 20px;
- margin: 10px 0 0 0;
-}
-
-tbody.footnotes * {
- border: none !important;
-}
-
-div.footnote p {
- margin: 0;
- line-height: 1;
-}
-
-div.footnote p sup {
- margin-right: 6px;
- vertical-align: middle;
-}
-
-div.navheader {
- border-bottom: 1px solid #CCCCCC;
-}
-
-div.navfooter {
- border-top: 1px solid #CCCCCC;
-}
-
-.title {
- margin-left: -1em;
- padding-left: 1em;
-}
-
-.title>a {
- position: absolute;
- visibility: hidden;
- display: block;
- font-size: 0.85em;
- margin-top: 0.05em;
- margin-left: -1em;
- vertical-align: text-top;
- color: black;
-}
-
-.title>a:before {
- content: "\00A7";
-}
-
-.title:hover>a,.title>a:hover,.title:hover>a:hover {
- visibility: visible;
-}
-
-.title:focus>a,.title>a:focus,.title:focus>a:focus {
- outline: 0;
-}
diff --git a/docs/target/generated-docs/multi/images/background.png b/docs/target/generated-docs/multi/images/background.png
deleted file mode 100644
index 15dca6fb..00000000
Binary files a/docs/target/generated-docs/multi/images/background.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/caution.png b/docs/target/generated-docs/multi/images/caution.png
deleted file mode 100644
index 8a5e4fca..00000000
Binary files a/docs/target/generated-docs/multi/images/caution.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/important.png b/docs/target/generated-docs/multi/images/important.png
deleted file mode 100644
index ec54df65..00000000
Binary files a/docs/target/generated-docs/multi/images/important.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/logo.png b/docs/target/generated-docs/multi/images/logo.png
deleted file mode 100644
index ade2ce6e..00000000
Binary files a/docs/target/generated-docs/multi/images/logo.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/note.png b/docs/target/generated-docs/multi/images/note.png
deleted file mode 100644
index 88d997b1..00000000
Binary files a/docs/target/generated-docs/multi/images/note.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/sts_exception.png b/docs/target/generated-docs/multi/images/sts_exception.png
deleted file mode 100644
index 8607c38a..00000000
Binary files a/docs/target/generated-docs/multi/images/sts_exception.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/tip.png b/docs/target/generated-docs/multi/images/tip.png
deleted file mode 100644
index 6530abb4..00000000
Binary files a/docs/target/generated-docs/multi/images/tip.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/warning.png b/docs/target/generated-docs/multi/images/warning.png
deleted file mode 100644
index 0d5b5244..00000000
Binary files a/docs/target/generated-docs/multi/images/warning.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/images/web-selected.png b/docs/target/generated-docs/multi/images/web-selected.png
deleted file mode 100644
index aa6b2da6..00000000
Binary files a/docs/target/generated-docs/multi/images/web-selected.png and /dev/null differ
diff --git a/docs/target/generated-docs/multi/multi__spring_cloud_commons_common_abstractions.html b/docs/target/generated-docs/multi/multi__spring_cloud_commons_common_abstractions.html
deleted file mode 100644
index dd831115..00000000
--- a/docs/target/generated-docs/multi/multi__spring_cloud_commons_common_abstractions.html
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
- 2. Spring Cloud Commons: Common Abstractions
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/generated-docs/multi/multi__spring_cloud_context_application_context_services.html b/docs/target/generated-docs/multi/multi__spring_cloud_context_application_context_services.html
deleted file mode 100644
index cdbb4381..00000000
--- a/docs/target/generated-docs/multi/multi__spring_cloud_context_application_context_services.html
+++ /dev/null
@@ -1,190 +0,0 @@
-
-
- 1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
\ No newline at end of file
diff --git a/docs/target/generated-docs/multi/multi_spring-cloud-commons.html b/docs/target/generated-docs/multi/multi_spring-cloud-commons.html
deleted file mode 100644
index 95bbb5c3..00000000
--- a/docs/target/generated-docs/multi/multi_spring-cloud-commons.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
- Cloud Native Applications
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
Note
Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
1. Spring Cloud Context: Application Context Services
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
1.1 The Bootstrap Application Context
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
1.2 Application Context Hierarchies
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
1.3 Changing the Location of Bootstrap Properties
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
1.4 Overriding the Values of Remote Properties
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
1.5 Customizing the Bootstrap Configuration
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
Warning
Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
1.6 Customizing the Bootstrap Property Sources
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
As an example, consider the following trivial custom locator:
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
1.7 Environment Changes
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
Re-bind any @ConfigurationProperties beans in the context
Set the logger levels for any properties in logging.level.*
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
1.8 Refresh Scope
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
Note
@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
1.9 Encryption and Decryption
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
1.10 Endpoints
For a Spring Boot Actuator application there are some additional management endpoints:
POST to /env to update the Environment and rebind @ConfigurationProperties and log levels
/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans
/restart for closing the ApplicationContext and restarting it (disabled by default)
/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)
2. Spring Cloud Commons: Common Abstractions
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
2.1 @EnableDiscoveryClient
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
2.1.1 Health Indicator
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
2.2 ServiceRegistry
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-publicclass MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- publicvoid register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
Each ServiceRegistry implementation has its own Registry implementation.
2.2.1 ServiceRegistry Auto-Registration
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
2.2.2 Service Registry Actuator Endpoint
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
2.3 Spring RestTemplate as a Load Balancer Client
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
Warning
A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
2.3.1 Retrying Failed Requests
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
Note
client in the above examples should be replaced with your Ribbon client’s
-name.
2.4 Multiple RestTemplate objects
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
Important
Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
2.5 Ignore Network Interfaces
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
\ No newline at end of file
diff --git a/docs/target/generated-docs/spring-cloud-commons.html b/docs/target/generated-docs/spring-cloud-commons.html
deleted file mode 100644
index 2059a373..00000000
--- a/docs/target/generated-docs/spring-cloud-commons.html
+++ /dev/null
@@ -1,1131 +0,0 @@
-
-
-
-
-
-
-
-Cloud Native Applications
-
-
-
-
-
Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
-
-
-
Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
-
-
-
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
-
-
-
-
-
-
Note
-
-
-Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
-
-
-
-
-
-
-
-
Spring Cloud Context: Application Context Services
-
-
-
Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
-
-
-
The Bootstrap Application Context
-
-
A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
-
-
-
The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
-
-
-
You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
-
-
-
-
Application Context Hierarchies
-
-
If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
-
-
-
-
-
"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
-
-
-
"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
-
-
-
-
-
Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
-
-
-
You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
-
-
-
Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
-
-
-
-
Changing the Location of Bootstrap Properties
-
-
The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
-
-
-
-
Overriding the Values of Remote Properties
-
-
The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
-
-
-
-
Customizing the Bootstrap Configuration
-
-
The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
-
-
-
-
-
-
Warning
-
-
-Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
-
-
-
-
-
-
The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
-
-
-
-
Customizing the Bootstrap Property Sources
-
-
The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
-
-
-
As an example, consider the following trivial custom locator:
-
-
-
-
@Configuration
-public class CustomPropertySourceLocator implements PropertySourceLocator {
-
- @Override
- public PropertySource<?> locate(Environment environment) {
- return new MapPropertySource("customProperty",
- Collections.<String, Object>singletonMap("property.from.sample.custom.source", "worked as intended"));
- }
-
-}
-
-
-
-
The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
-
-
-
If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
-
-
-
-
Environment Changes
-
-
The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
-
-
-
-
-
Re-bind any @ConfigurationProperties beans in the context
-
-
-
Set the logger levels for any properties in logging.level.*
-
-
-
-
-
Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
-
-
-
The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
-
-
-
-
Refresh Scope
-
-
A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
-
-
-
Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
-
-
-
The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
-
-
-
-
-
-
Note
-
-
-@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
-
-
-
-
-
-
-
Encryption and Decryption
-
-
Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
-
-
-
If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
-
-
-
-
Endpoints
-
-
For a Spring Boot Actuator application there are some additional management endpoints:
-
-
-
-
-
POST to /env to update the Environment and rebind @ConfigurationProperties and log levels
-
-
-
/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans
-
-
-
/restart for closing the ApplicationContext and restarting it (disabled by default)
-
-
-
/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)
-
-
-
-
-
-
-
-
Spring Cloud Commons: Common Abstractions
-
-
-
Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
-
-
-
@EnableDiscoveryClient
-
-
Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
-
-
-
By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
-
-
-
-
ServiceRegistry
-
-
Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
-
-
-
-
@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-public class MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- public void register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
-
-
-
-
Each ServiceRegistry implementation has its own Registry implementation.
-
-
-
ServiceRegistry Auto-Registration
-
-
By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
-
-
-
-
Service Registry Actuator Endpoint
-
-
A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
-
-
-
-
-
Spring RestTemplate as a Load Balancer Client
-
-
RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
-
-
-
-
-
-
Warning
-
-
-A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
-
The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
-
-
-
Retrying Failed Requests
-
-
A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
-
-
-
-
-
-
Note
-
-
-client in the above examples should be replaced with your Ribbon client’s
-name.
-
-
-
-
-
-
-
-
Multiple RestTemplate objects
-
-
If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
-
-
-
-
-
-
Important
-
-
-Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
-
-If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
-
-
-
-
-
-
-
Ignore Network Interfaces
-
-
Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
-
-
\ No newline at end of file
diff --git a/docs/target/generated-docs/spring-cloud-commons.xml b/docs/target/generated-docs/spring-cloud-commons.xml
deleted file mode 100644
index 72006cae..00000000
--- a/docs/target/generated-docs/spring-cloud-commons.xml
+++ /dev/null
@@ -1,511 +0,0 @@
-
-
-
-
-
-Cloud Native Applications
-2017-08-29
-
-
-
-Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Apps in which development practices are aligned with delivery and operations goals, for instance by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways and the starting point is a set of features that all components in a distributed system either need or need easy access to when required.
-Many of those features are covered by Spring Boot, which we build on in Spring Cloud. Some more are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (eg. Spring Cloud Netflix vs. Spring Cloud Consul).
-If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
-
-
-Java 6 JCE
-
-
-Java 7 JCE
-
-
-Java 8 JCE
-
-
-Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
-
-Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.
-
-
-
-Spring Cloud Context: Application Context Services
-Spring Boot has an opinionated view of how to build an application
-with Spring: for instance it has conventional locations for common
-configuration file, and endpoints for common management and monitoring
-tasks. Spring Cloud builds on top of that and adds a few features that
-probably all components in a system would use or occasionally need.
-
-The Bootstrap Application Context
-A Spring Cloud application operates by creating a "bootstrap"
-context, which is a parent context for the main application. Out of
-the box it is responsible for loading configuration properties from
-the external sources, and also decrypting properties in the local
-external configuration files. The two contexts share an Environment
-which is the source of external properties for any Spring
-application. Bootstrap properties are added with high precedence, so
-they cannot be overridden by local configuration, by default.
-The bootstrap context uses a different convention for locating
-external configuration than the main application context, so instead
-of application.yml (or .properties) you use bootstrap.yml,
-keeping the external configuration for bootstrap and main context
-nicely separate. Example:
-
-bootstrap.yml
-
-spring:
- application:
- name: foo
- cloud:
- config:
- uri: ${SPRING_CONFIG_URI:http://localhost:8888}
-
-
-It is a good idea to set the spring.application.name (in
-bootstrap.yml or application.yml) if your application needs any
-application-specific configuration from the server.
-You can disable the bootstrap process completely by setting
-spring.cloud.bootstrap.enabled=false (e.g. in System properties).
-
-
-Application Context Hierarchies
-If you build an application context from SpringApplication or
-SpringApplicationBuilder, then the Bootstrap context is added as a
-parent to that context. It is a feature of Spring that child contexts
-inherit property sources and profiles from their parent, so the "main"
-application context will contain additional property sources, compared
-to building the same context without Spring Cloud Config. The
-additional property sources are:
-
-
-"bootstrap": an optional CompositePropertySource appears with high
-priority if any PropertySourceLocators are found in the Bootstrap
-context, and they have non-empty properties. An example would be
-properties from the Spring Cloud Config Server. See
-below for instructions
-on how to customize the contents of this property source.
-
-
-"applicationConfig: [classpath:bootstrap.yml]" (and friends if
-Spring profiles are active). If you have a bootstrap.yml (or
-properties) then those properties are used to configure the Bootstrap
-context, and then they get added to the child context when its parent
-is set. They have lower precedence than the application.yml (or
-properties) and any other property sources that are added to the child
-as a normal part of the process of creating a Spring Boot
-application. See below for
-instructions on how to customize the contents of these property
-sources.
-
-
-Because of the ordering rules of property sources the "bootstrap"
-entries take precedence, but note that these do not contain any data
-from bootstrap.yml, which has very low precedence, but can be used
-to set defaults.
-You can extend the context hierarchy by simply setting the parent
-context of any ApplicationContext you create, e.g. using its own
-interface, or with the SpringApplicationBuilder convenience methods
-(parent(), child() and sibling()). The bootstrap context will be
-the parent of the most senior ancestor that you create yourself.
-Every context in the hierarchy will have its own "bootstrap" property
-source (possibly empty) to avoid promoting values inadvertently from
-parents down to their descendants. Every context in the hierarchy can
-also (in principle) have a different spring.application.name and
-hence a different remote property source if there is a Config
-Server. Normal Spring application context behaviour rules apply to
-property resolution: properties from a child context override those in
-the parent, by name and also by property source name (if the child has
-a property source with the same name as the parent, the one from the
-parent is not included in the child).
-Note that the SpringApplicationBuilder allows you to share an
-Environment amongst the whole hierarchy, but that is not the
-default. Thus, sibling contexts in particular do not need to have the
-same profiles or property sources, even though they will share common
-things with their parent.
-
-
-Changing the Location of Bootstrap Properties
-The bootstrap.yml (or .properties) location can be specified using
-spring.cloud.bootstrap.name (default "bootstrap") or
-spring.cloud.bootstrap.location (default empty), e.g. in System
-properties. Those properties behave like the spring.config.*
-variants with the same name, in fact they are used to set up the
-bootstrap ApplicationContext by setting those properties in its
-Environment. If there is an active profile (from
-spring.profiles.active or through the Environment API in the
-context you are building) then properties in that profile will be
-loaded as well, just like in a regular Spring Boot app, e.g. from
-bootstrap-development.properties for a "development" profile.
-
-
-Overriding the Values of Remote Properties
-The property sources that are added to you application by the
-bootstrap context are often "remote" (e.g. from a Config Server), and
-by default they cannot be overridden locally, except on the command
-line. If you want to allow your applications to override the remote
-properties with their own System properties or config files, the
-remote property source has to grant it permission by setting
-spring.cloud.config.allowOverride=true (it doesn’t work to set this
-locally). Once that flag is set there are some finer grained settings
-to control the location of the remote properties in relation to System
-properties and the application’s local configuration:
-spring.cloud.config.overrideNone=true to override with any local
-property source, and
-spring.cloud.config.overrideSystemProperties=false if only System
-properties and env vars should override the remote settings, but not
-the local config files.
-
-
-Customizing the Bootstrap Configuration
-The bootstrap context can be trained to do anything you like by adding
-entries to /META-INF/spring.factories under the key
-org.springframework.cloud.bootstrap.BootstrapConfiguration. This is
-a comma-separated list of Spring @Configuration classes which will
-be used to create the context. Any beans that you want to be available
-to the main application context for autowiring can be created here,
-and also there is a special contract for @Beans of type
-ApplicationContextInitializer. Classes can be marked with an @Order
-if you want to control the startup sequence (the default order is
-"last").
-
-Be careful when adding custom BootstrapConfiguration that the
-classes you add are not @ComponentScanned by mistake into your
-"main" application context, where they might not be needed.
-Use a separate package name for boot configuration classes that is
-not already covered by your @ComponentScan or @SpringBootApplication
-annotated configuration classes.
-
-The bootstrap process ends by injecting initializers into the main
-SpringApplication instance (i.e. the normal Spring Boot startup
-sequence, whether it is running as a standalone app or deployed in an
-application server). First a bootstrap context is created from the
-classes found in spring.factories and then all @Beans of type
-ApplicationContextInitializer are added to the main
-SpringApplication before it is started.
-
-
-Customizing the Bootstrap Property Sources
-The default property source for external configuration added by the
-bootstrap process is the Config Server, but you can add additional
-sources by adding beans of type PropertySourceLocator to the
-bootstrap context (via spring.factories). You could use this to
-insert additional properties from a different server, or from a
-database, for instance.
-As an example, consider the following trivial custom locator:
-@Configuration
-public class CustomPropertySourceLocator implements PropertySourceLocator {
-
- @Override
- public PropertySource<?> locate(Environment environment) {
- return new MapPropertySource("customProperty",
- Collections.<String, Object>singletonMap("property.from.sample.custom.source", "worked as intended"));
- }
-
-}
-The Environment that is passed in is the one for the
-ApplicationContext about to be created, i.e. the one that we are
-supplying additional property sources for. It will already have its
-normal Spring Boot-provided property sources, so you can use those to
-locate a property source specific to this Environment (e.g. by
-keying it on the spring.application.name, as is done in the default
-Config Server property source locator).
-If you create a jar with this class in it and then add a
-META-INF/spring.factories containing:
-org.springframework.cloud.bootstrap.BootstrapConfiguration=sample.custom.CustomPropertySourceLocator
-then the "customProperty" PropertySource will show up in any
-application that includes that jar on its classpath.
-
-
-Environment Changes
-The application will listen for an EnvironmentChangeEvent and react
-to the change in a couple of standard ways (additional
-ApplicationListeners can be added as @Beans by the user in the
-normal way). When an EnvironmentChangeEvent is observed it will
-have a list of key values that have changed, and the application will
-use those to:
-
-
-Re-bind any @ConfigurationProperties beans in the context
-
-
-Set the logger levels for any properties in logging.level.*
-
-
-Note that the Config Client does not by default poll for changes in
-the Environment, and generally we would not recommend that approach
-for detecting changes (although you could set it up with a
-@Scheduled annotation). If you have a scaled-out client application
-then it is better to broadcast the EnvironmentChangeEvent to all
-the instances instead of having them polling for changes (e.g. using
-the Spring Cloud
-Bus).
-The EnvironmentChangeEvent covers a large class of refresh use
-cases, as long as you can actually make a change to the Environment
-and publish the event (those APIs are public and part of core
-Spring). You can verify the changes are bound to
-@ConfigurationProperties beans by visiting the /configprops
-endpoint (normal Spring Boot Actuator feature). For instance a
-DataSource can have its maxPoolSize changed at runtime (the
-default DataSource created by Spring Boot is an
-@ConfigurationProperties bean) and grow capacity
-dynamically. Re-binding @ConfigurationProperties does not cover
-another large class of use cases, where you need more control over the
-refresh, and where you need a change to be atomic over the whole
-ApplicationContext. To address those concerns we have
-@RefreshScope.
-
-
-Refresh Scope
-A Spring @Bean that is marked as @RefreshScope will get special
-treatment when there is a configuration change. This addresses the
-problem of stateful beans that only get their configuration injected
-when they are initialized. For instance if a DataSource has open
-connections when the database URL is changed via the Environment, we
-probably want the holders of those connections to be able to complete
-what they are doing. Then the next time someone borrows a connection
-from the pool he gets one with the new URL.
-Refresh scope beans are lazy proxies that initialize when they are
-used (i.e. 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 just need to invalidate its cache entry.
-The RefreshScope is a bean in the context and it has a public method
-refreshAll() to refresh all beans in the scope by clearing the
-target cache. There is also a refresh(String) method to refresh an
-individual bean by name. This functionality is exposed in the
-/refresh endpoint (over HTTP or JMX).
-
-@RefreshScope works (technically) on an @Configuration
-class, but it might lead to surprising behaviour: e.g. it does not
-mean that all the @Beans defined in that class are themselves
-@RefreshScope. Specifically, anything that depends on those beans
-cannot rely on them being updated when a refresh is initiated, unless
-it is itself in @RefreshScope (in which it will be rebuilt on a
-refresh and its dependencies re-injected, at which point they will be
-re-initialized from the refreshed @Configuration).
-
-
-
-Encryption and Decryption
-Spring Cloud has an Environment pre-processor for decrypting
-property values locally. It follows the same rules as the Config
-Server, and has the same external configuration via encrypt.*. Thus
-you can use encrypted values in the form {cipher}* and as long as
-there is a valid key then they will be decrypted before the main
-application context gets the Environment. To use the encryption
-features in an application you need to include Spring Security RSA in
-your classpath (Maven co-ordinates
-"org.springframework.security:spring-security-rsa") and you also need
-the full strength JCE extensions in your JVM.
-If you are getting an exception due to "Illegal key size" and you are using Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See the following links for more information:
-
-
-Java 6 JCE
-
-
-Java 7 JCE
-
-
-Java 8 JCE
-
-
-Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).
-
-
-Endpoints
-For a Spring Boot Actuator application there are some additional management endpoints:
-
-
-POST to /env to update the Environment and rebind @ConfigurationProperties and log levels
-
-
-/refresh for re-loading the boot strap context and refreshing the @RefreshScope beans
-
-
-/restart for closing the ApplicationContext and restarting it (disabled by default)
-
-
-/pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)
-
-
-
-
-
-Spring Cloud Commons: Common Abstractions
-Patterns such as service discovery, load balancing and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (e.g. discovery via Eureka or Consul).
-
-@EnableDiscoveryClient
-Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface via META-INF/spring.factories. Implementations of Discovery Client will add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations: are Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery and Spring Cloud Zookeeper Discovery.
-By default, implementations of DiscoveryClient will auto-register the local Spring Boot server with the remote discovery server. This can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
-
-Health Indicator
-Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator. To disable the composite HealthIndicator set spring.cloud.discovery.client.composite-indicator.enabled=false. A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator). To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false. To disable the description field of the DiscoveryClientHealthIndicator set spring.cloud.discovery.client.health-indicator.include-description=false, otherwise it can bubble up as the description of the rolled up HealthIndicator.
-
-
-
-ServiceRegistry
-Commons now provides a ServiceRegistry interface which provides methods like register(Registration) and deregister(Registration) which allow you to provide custom registered services. Registration is a marker interface.
-@Configuration
-@EnableDiscoveryClient(autoRegister=false)
-public class MyConfiguration {
- private ServiceRegistry registry;
-
- public MyConfiguration(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // called via some external process, such as an event or a custom actuator endpoint
- public void register() {
- Registration registration = constructRegistration();
- this.registry.register(registration);
- }
-}
-Each ServiceRegistry implementation has its own Registry implementation.
-
-ServiceRegistry Auto-Registration
-By default, the ServiceRegistry implementation will auto-register the running service. To disable that behavior, there are two methods. You can set @EnableDiscoveryClient(autoRegister=false) to permanently disable auto-registration. You can also set spring.cloud.service-registry.auto-registration.enabled=false to disable the behavior via configuration.
-
-
-Service Registry Actuator Endpoint
-A /service-registry actuator endpoint is provided by Commons. This endpoint relys on a Registration bean in the Spring Application Context. Calling /service-registry/instance-status via a GET will return the status of the Registration. A POST to the same endpoint with a String body will change the status of the current Registration to the new value. Please see the documentation of the ServiceRegistry implementation you are using for the allowed values for updating the status and the values retured for the status.
-
-
-
-Spring RestTemplate as a Load Balancer Client
-RestTemplate can be automatically configured to use ribbon. To create a load balanced RestTemplate create a RestTemplate@Bean and use the @LoadBalanced qualifier.
-
-A RestTemplate bean is no longer created via auto configuration. It must be created by individual applications.
-
-@Configuration
-public class MyConfiguration {
-
- @LoadBalanced
- @Bean
- RestTemplate restTemplate() {
- return new RestTemplate();
- }
-}
-
-public class MyClass {
- @Autowired
- private RestTemplate restTemplate;
-
- public String doOtherStuff() {
- String results = restTemplate.getForObject("http://stores/stores", String.class);
- return results;
- }
-}
-The URI needs to use a virtual host name (ie. service name, not a host name).
-The Ribbon client is used to create a full physical address. See
-RibbonAutoConfiguration
-for details of how the RestTemplate is set up.
-
-Retrying Failed Requests
-A load balanced RestTemplate can be configured to retry failed requests.
-By default this logic is disabled, you can enable it by adding Spring Retry to your application’s classpath. The load balanced RestTemplate will
-honor some of the Ribbon configuration values related to retrying failed requests. If
-you would like to disable the retry logic with Spring Retry on the classpath
-you can set spring.cloud.loadbalancer.retry.enabled=false.
-The properties you can use are client.ribbon.MaxAutoRetries,
-client.ribbon.MaxAutoRetriesNextServer, and client.ribbon.OkToRetryOnAllOperations.
-See the Ribbon documentation
-for a description of what there properties do.
-
-client in the above examples should be replaced with your Ribbon client’s
-name.
-
-
-
-
-Multiple RestTemplate objects
-If you want a RestTemplate that is not load balanced, create a RestTemplate
-bean and inject it as normal. To access the load balanced RestTemplate use
-the @LoadBalanced qualifier when you create your @Bean.
-
-Notice the @Primary annotation on the plain RestTemplate declaration in the example below, to disambiguate the unqualified @Autowired injection.
-
-@Configuration
-public class MyConfiguration {
-
- @LoadBalanced
- @Bean
- RestTemplate loadBalanced() {
- return new RestTemplate();
- }
-
- @Primary
- @Bean
- RestTemplate restTemplate() {
- return new RestTemplate();
- }
-}
-
-public class MyClass {
- @Autowired
- private RestTemplate restTemplate;
-
- @Autowired
- @LoadBalanced
- private RestTemplate loadBalanced;
-
- public String doOtherStuff() {
- return loadBalanced.getForObject("http://stores/stores", String.class);
- }
-
- public String doStuff() {
- return restTemplate.getForObject("http://example.com", String.class);
- }
-}
-
-If you see errors like java.lang.IllegalArgumentException: Can not set org.springframework.web.client.RestTemplate field com.my.app.Foo.restTemplate to com.sun.proxy.$Proxy89 try injecting RestOperations instead or setting spring.aop.proxyTargetClass=true.
-
-
-
-Ignore Network Interfaces
-Sometimes it is useful to ignore certain named network interfaces so they can be excluded from Service Discovery registration (eg. running in a Docker container). A list of regular expressions can be set that will cause the desired network interfaces to be ignored. The following configuration will ignore the "docker0" interface and all interfaces that start with "veth".
-
-application.yml
-
-spring:
- cloud:
- inetutils:
- ignoredInterfaces:
- - docker0
- - veth.*
-
-
-You can also force to use only specified network addresses using list of regular expressions:
-
-application.yml
-
-spring:
- cloud:
- inetutils:
- preferredNetworks:
- - 192.168
- - 10.0
-
-
-You can also force to use only site local addresses. See Inet4Address.html.isSiteLocalAddress() for more details what is site local address.
-
-application.yml
-
-spring:
- cloud:
- inetutils:
- useOnlySiteLocalInterfaces: true
-
-
-
-
-HTTP Client Factories
-Spring Cloud Commons provides beans for creating both Apache HTTP clients (ApacheHttpClientFactory)
-as well as OK HTTP clients (OkHttpClientFactory). The OkHttpClientFactory bean will only be created
-if the OK HTTP jar is on the classpath. In addition, Spring Cloud Commons provides beans for creating
-the connection managers used by both clients, ApacheHttpClientConnectionManagerFactory for the Apache
-HTTP client and OkHttpClientConnectionPoolFactory for the OK HTTP client. You can provide
-your own implementation of these beans if you would like to customize how the HTTP clients are created
-in downstream projects. You can also disable the creation of these beans by setting
-spring.cloud.httpclientfactories.apache.enabled or spring.cloud.httpclientfactories.ok.enabled to
-false.
-
-
-
\ No newline at end of file
diff --git a/docs/target/maven-archiver/pom.properties b/docs/target/maven-archiver/pom.properties
deleted file mode 100644
index 9321bab7..00000000
--- a/docs/target/maven-archiver/pom.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-#Created by Apache Maven 3.3.9
-#Tue Apr 04 02:50:41 UTC 2017
-version=1.2.0.BUILD-SNAPSHOT
-groupId=org.springframework.cloud
-artifactId=spring-cloud-commons-docs
diff --git a/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT-tests.jar b/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT-tests.jar
deleted file mode 100644
index 716b6579..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT-tests.jar and /dev/null differ
diff --git a/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT.zip b/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT.zip
deleted file mode 100644
index 4b88a3f6..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.2.0.BUILD-SNAPSHOT.zip and /dev/null differ
diff --git a/docs/target/spring-cloud-commons-docs-1.2.1.BUILD-SNAPSHOT.zip b/docs/target/spring-cloud-commons-docs-1.2.1.BUILD-SNAPSHOT.zip
deleted file mode 100644
index d5bb4ab5..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.2.1.BUILD-SNAPSHOT.zip and /dev/null differ
diff --git a/docs/target/spring-cloud-commons-docs-1.2.2.BUILD-SNAPSHOT.zip b/docs/target/spring-cloud-commons-docs-1.2.2.BUILD-SNAPSHOT.zip
deleted file mode 100644
index 8e5a1488..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.2.2.BUILD-SNAPSHOT.zip and /dev/null differ
diff --git a/docs/target/spring-cloud-commons-docs-1.2.3.BUILD-SNAPSHOT.zip b/docs/target/spring-cloud-commons-docs-1.2.3.BUILD-SNAPSHOT.zip
deleted file mode 100644
index e2cf7348..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.2.3.BUILD-SNAPSHOT.zip and /dev/null differ
diff --git a/docs/target/spring-cloud-commons-docs-1.3.0.BUILD-SNAPSHOT.zip b/docs/target/spring-cloud-commons-docs-1.3.0.BUILD-SNAPSHOT.zip
deleted file mode 100644
index e57aac12..00000000
Binary files a/docs/target/spring-cloud-commons-docs-1.3.0.BUILD-SNAPSHOT.zip and /dev/null differ
diff --git a/docs/target/spring-cloud-commons.adoc b/docs/target/spring-cloud-commons.adoc
deleted file mode 100644
index 1275f30a..00000000
--- a/docs/target/spring-cloud-commons.adoc
+++ /dev/null
@@ -1,13 +0,0 @@
-:nofooter:
-:linkcss:
-:stylesdir: css
-:stylesheet: manual-singlepage.css
-
-= {docs-main}
-
-{spring-cloud-version}
-
-== Pick The Documentation Option
-
-- link:single/{docs-main}.html[Single HTML]
-- link:multi/{docs-main}.html[Multi HTML]
\ No newline at end of file