Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
Spring Operator | 3109b9b649 | 6 years ago |
Spring Operator | f9eb5b88c6 | 6 years ago |
Spring Operator | 5823de6d39 | 6 years ago |
Spring Operator | 789fc4074b | 6 years ago |
Marcin Grzejszczak | d8df9bb88e | 8 years ago |
Marcin Grzejszczak | e016c1eb4c | 8 years ago |
Spencer Gibb | 3ecea5b050 | 9 years ago |
Dave Syer | 7ce5b87096 | 9 years ago |
Dave Syer | 7f897d59ee | 9 years ago |
Dave Syer | 2305011003 | 9 years ago |
Dave Syer | 92b6a4d1e6 | 9 years ago |
Dave Syer | 8864a53485 | 9 years ago |
Dave Syer | d5b1ee4bb5 | 9 years ago |
584 changed files with 5742 additions and 52655 deletions
@ -1,24 +0,0 @@
@@ -1,24 +0,0 @@
|
||||
root = true |
||||
|
||||
[*.java] |
||||
indent_style = tab |
||||
indent_size = 4 |
||||
continuation_indent_size = 8 |
||||
|
||||
[*.groovy] |
||||
indent_style = tab |
||||
indent_size = 4 |
||||
continuation_indent_size = 8 |
||||
|
||||
[*.xml] |
||||
indent_style = tab |
||||
indent_size = 4 |
||||
continuation_indent_size = 8 |
||||
|
||||
[*.yml] |
||||
indent_style = space |
||||
indent_size = 2 |
||||
|
||||
[*.yaml] |
||||
indent_style = space |
||||
indent_size = 2 |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
|
||||
# Contributing |
||||
|
||||
Spring Cloud is released under the non-restrictive Apache 2.0 license, |
||||
and follows a very standard Github development process, using Github |
||||
tracker for issues and merging pull requests into main. If you want |
||||
to contribute even something trivial please do not hesitate, but |
||||
follow the guidelines below. |
||||
|
||||
## Sign the Contributor License Agreement |
||||
Before we accept a non-trivial patch or pull request we will need you to sign the |
||||
[Contributor License Agreement](https://cla.pivotal.io/sign/spring). |
||||
Signing the contributor's agreement does not grant anyone commit rights to the main |
||||
repository, but it does mean that we can accept your contributions, and you will get an |
||||
author credit if we do. Active contributors might be asked to join the core team, and |
||||
given the ability to merge pull requests. |
||||
|
||||
## Code of Conduct |
||||
This project adheres to the Contributor Covenant [code of |
||||
conduct](https://github.com/spring-cloud/spring-cloud-build/blob/main/docs/src/main/asciidoc/code-of-conduct.adoc). By participating, you are expected to uphold this code. Please report |
||||
unacceptable behavior to spring-code-of-conduct@pivotal.io. |
||||
|
||||
## Code Conventions and Housekeeping |
||||
None of these is essential for a pull request, but they will all help. They can also be |
||||
added after the original pull request but before a merge. |
||||
|
||||
* Use the Spring Framework code format conventions. If you use Eclipse |
||||
you can import formatter settings using the |
||||
`eclipse-code-formatter.xml` file from the |
||||
[Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the |
||||
[Eclipse Code Formatter Plugin](https://plugins.jetbrains.com/plugin/6546) to import the same file. |
||||
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an |
||||
`@author` tag identifying you, and preferably at least a paragraph on what the class is |
||||
for. |
||||
* Add the ASF license header comment to all new `.java` files (copy from existing files |
||||
in the project) |
||||
* Add yourself as an `@author` to the .java files that you modify substantially (more |
||||
than cosmetic changes). |
||||
* Add some Javadocs and, if you change the namespace, some XSD doc elements. |
||||
* A few unit tests would help a lot as well -- someone has to do it. |
||||
* If no-one else is using your branch, please rebase it against the current main (or |
||||
other target branch in the main project). |
||||
* When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), |
||||
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit |
||||
message (where XXXX is the issue number). |
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
<!-- |
||||
Thanks for raising a Spring Cloud issue. What sort of issue are you raising? |
||||
|
||||
Question |
||||
|
||||
Please ask questions about how to use something, or to understand why something isn't |
||||
working as you expect it to, on Stack Overflow using the spring-cloud tag. |
||||
|
||||
Bug report |
||||
|
||||
Please provide details of the problem, including the version of Spring Cloud that you |
||||
are using. If possible, please provide a test case or sample application that reproduces |
||||
the problem. This makes it much easier for us to diagnose the problem and to verify that |
||||
we have fixed it. |
||||
|
||||
Enhancement |
||||
|
||||
Please start by describing the problem that you are trying to solve. There may already |
||||
be a solution, or there may be a way to solve it that you hadn't considered. |
||||
--> |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
--- |
||||
name: Bug report |
||||
about: Create a report to help us improve |
||||
title: '' |
||||
labels: '' |
||||
assignees: '' |
||||
|
||||
--- |
||||
|
||||
**Describe the bug** |
||||
Please provide details of the problem, including the version of Spring Cloud that you |
||||
are using. |
||||
|
||||
**Sample** |
||||
If possible, please provide a test case or sample application that reproduces |
||||
the problem. This makes it much easier for us to diagnose the problem and to verify that |
||||
we have fixed it. |
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
--- |
||||
name: Feature request |
||||
about: Suggest an idea for this project |
||||
title: '' |
||||
labels: '' |
||||
assignees: '' |
||||
|
||||
--- |
||||
|
||||
**Is your feature request related to a problem? Please describe.** |
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] |
||||
|
||||
**Describe the solution you'd like** |
||||
A clear and concise description of what you want to happen. |
||||
|
||||
**Describe alternatives you've considered** |
||||
A clear and concise description of any alternative solutions or features you've considered. |
||||
|
||||
**Additional context** |
||||
Add any other context or screenshots about the feature request here. |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
version: 2 |
||||
updates: |
||||
- package-ecosystem: "github-actions" |
||||
directory: "/" |
||||
target-branch: "3.1.x" # oldest OSS supported branch |
||||
schedule: |
||||
interval: "weekly" |
||||
- package-ecosystem: "github-actions" |
||||
directory: "/" |
||||
target-branch: "4.0.x" # oldest OSS supported branch |
||||
schedule: |
||||
interval: "weekly" |
||||
- package-ecosystem: "github-actions" |
||||
directory: "/" |
||||
target-branch: "main" |
||||
schedule: |
||||
interval: "weekly" |
||||
- package-ecosystem: maven |
||||
directory: / |
||||
schedule: |
||||
interval: daily |
||||
target-branch: 3.1.x |
||||
ignore: |
||||
# only upgrade patch versions for maintenance branch |
||||
- dependency-name: "*" |
||||
update-types: |
||||
- version-update:semver-major |
||||
- version-update:semver-minor |
||||
- package-ecosystem: maven |
||||
directory: / |
||||
schedule: |
||||
interval: daily |
||||
target-branch: 4.0.x |
||||
ignore: |
||||
# only upgrade patch versions for maintenance branch |
||||
- dependency-name: "*" |
||||
update-types: |
||||
- version-update:semver-major |
||||
- version-update:semver-minor |
||||
- package-ecosystem: maven |
||||
directory: / |
||||
schedule: |
||||
interval: daily |
||||
target-branch: main |
||||
ignore: |
||||
# only upgrade by minor or patch |
||||
- dependency-name: "*" |
||||
update-types: |
||||
- version-update:semver-major |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
name: Deploy Docs |
||||
on: |
||||
push: |
||||
branches-ignore: [ gh-pages ] |
||||
tags: '**' |
||||
repository_dispatch: |
||||
types: request-build-reference # legacy |
||||
#schedule: |
||||
#- cron: '0 10 * * *' # Once per day at 10am UTC |
||||
workflow_dispatch: |
||||
permissions: |
||||
actions: write |
||||
jobs: |
||||
build: |
||||
runs-on: ubuntu-latest |
||||
# FIXME: enable when pushed to spring-projects |
||||
# if: github.repository_owner == 'spring-projects' |
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v4 |
||||
with: |
||||
ref: docs-build |
||||
fetch-depth: 1 |
||||
- name: Dispatch (partial build) |
||||
if: github.ref_type == 'branch' |
||||
env: |
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }} |
||||
- name: Dispatch (full build) |
||||
if: github.ref_type == 'tag' |
||||
env: |
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) |
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
# This workflow will build a Java project with Maven |
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven |
||||
|
||||
name: Build |
||||
|
||||
on: |
||||
push: |
||||
branches: [ main, 4.0.x, 3.1.x ] |
||||
pull_request: |
||||
branches: [ main, 4.0.x, 3.1.x ] |
||||
|
||||
jobs: |
||||
build: |
||||
|
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
- name: Set up JDK |
||||
uses: actions/setup-java@v3 |
||||
with: |
||||
distribution: 'temurin' |
||||
java-version: '17' |
||||
- name: Cache local Maven repository |
||||
uses: actions/cache@v3 |
||||
with: |
||||
path: ~/.m2/repository |
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
||||
restore-keys: | |
||||
${{ runner.os }}-maven- |
||||
- name: Build with Maven |
||||
run: ./mvnw -s .settings.xml clean org.jacoco:jacoco-maven-plugin:prepare-agent install -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn |
||||
- name: Publish Test Report |
||||
uses: mikepenz/action-junit-report@v4 |
||||
if: always() # always run even if the previous step fails |
||||
with: |
||||
report_paths: '**/surefire-reports/TEST-*.xml' |
||||
- name: Archive code coverage results |
||||
uses: actions/upload-artifact@v3 |
||||
with: |
||||
name: surefire-reports |
||||
path: '**/surefire-reports/*' |
@ -1,117 +0,0 @@
@@ -1,117 +0,0 @@
|
||||
/* |
||||
* Copyright 2007-present the original author or authors. |
||||
* |
||||
* 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. |
||||
*/ |
||||
import java.net.*; |
||||
import java.io.*; |
||||
import java.nio.channels.*; |
||||
import java.util.Properties; |
||||
|
||||
public class MavenWrapperDownloader { |
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6"; |
||||
/** |
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
||||
*/ |
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
||||
|
||||
/** |
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
||||
* use instead of the default one. |
||||
*/ |
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
||||
".mvn/wrapper/maven-wrapper.properties"; |
||||
|
||||
/** |
||||
* Path where the maven-wrapper.jar will be saved to. |
||||
*/ |
||||
private static final String MAVEN_WRAPPER_JAR_PATH = |
||||
".mvn/wrapper/maven-wrapper.jar"; |
||||
|
||||
/** |
||||
* Name of the property which should be used to override the default download url for the wrapper. |
||||
*/ |
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
||||
|
||||
public static void main(String args[]) { |
||||
System.out.println("- Downloader started"); |
||||
File baseDirectory = new File(args[0]); |
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
||||
String url = DEFAULT_DOWNLOAD_URL; |
||||
if(mavenWrapperPropertyFile.exists()) { |
||||
FileInputStream mavenWrapperPropertyFileInputStream = null; |
||||
try { |
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
||||
Properties mavenWrapperProperties = new Properties(); |
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
||||
} catch (IOException e) { |
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
||||
} finally { |
||||
try { |
||||
if(mavenWrapperPropertyFileInputStream != null) { |
||||
mavenWrapperPropertyFileInputStream.close(); |
||||
} |
||||
} catch (IOException e) { |
||||
// Ignore ...
|
||||
} |
||||
} |
||||
} |
||||
System.out.println("- Downloading from: " + url); |
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
||||
if(!outputFile.getParentFile().exists()) { |
||||
if(!outputFile.getParentFile().mkdirs()) { |
||||
System.out.println( |
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
||||
} |
||||
} |
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
||||
try { |
||||
downloadFileFromURL(url, outputFile); |
||||
System.out.println("Done"); |
||||
System.exit(0); |
||||
} catch (Throwable e) { |
||||
System.out.println("- Error downloading"); |
||||
e.printStackTrace(); |
||||
System.exit(1); |
||||
} |
||||
} |
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
||||
String username = System.getenv("MVNW_USERNAME"); |
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
||||
Authenticator.setDefault(new Authenticator() { |
||||
@Override |
||||
protected PasswordAuthentication getPasswordAuthentication() { |
||||
return new PasswordAuthentication(username, password); |
||||
} |
||||
}); |
||||
} |
||||
URL website = new URL(urlString); |
||||
ReadableByteChannel rbc; |
||||
rbc = Channels.newChannel(website.openStream()); |
||||
FileOutputStream fos = new FileOutputStream(destination); |
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
||||
fos.close(); |
||||
rbc.close(); |
||||
} |
||||
|
||||
} |
Binary file not shown.
@ -1,2 +1 @@
@@ -1,2 +1 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
||||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
# Enable auto-env through the sdkman_auto_env config |
||||
# Add key=value pairs of SDKs to use below |
||||
java=17.0.1-tem |
@ -1,68 +1,60 @@
@@ -1,68 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<settings> |
||||
<servers> |
||||
<server> |
||||
<id>repo.spring.io</id> |
||||
<username>${env.CI_DEPLOY_USERNAME}</username> |
||||
<password>${env.CI_DEPLOY_PASSWORD}</password> |
||||
</server> |
||||
</servers> |
||||
<profiles> |
||||
<profile> |
||||
<!-- |
||||
N.B. this profile is only here to support users and IDEs that do not use Maven 3.3. |
||||
It isn't needed on the command line if you use the wrapper script (mvnw) or if you use |
||||
a native Maven with the right version. Eclipse users should points their Maven tooling to |
||||
this settings file, or copy the profile into their ~/.m2/settings.xml. |
||||
--> |
||||
<id>spring</id> |
||||
<activation> |
||||
<activeByDefault>true</activeByDefault> |
||||
</activation> |
||||
<repositories> |
||||
<repository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/libs-snapshot-local</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/libs-milestone-local</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-releases</id> |
||||
<name>Spring Releases</name> |
||||
<url>https://repo.spring.io/release</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
</repositories> |
||||
<pluginRepositories> |
||||
<pluginRepository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/libs-snapshot-local</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
<pluginRepository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/libs-milestone-local</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
</pluginRepositories> |
||||
</profile> |
||||
</profiles> |
||||
<servers> |
||||
<server> |
||||
<id>repo.spring.io</id> |
||||
<username>${env.CI_DEPLOY_USERNAME}</username> |
||||
<password>${env.CI_DEPLOY_PASSWORD}</password> |
||||
</server> |
||||
</servers> |
||||
<profiles> |
||||
<profile> |
||||
<id>spring</id> |
||||
<activation><activeByDefault>true</activeByDefault></activation> |
||||
<repositories> |
||||
<repository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/libs-snapshot-local</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/libs-milestone-local</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-releases</id> |
||||
<name>Spring Releases</name> |
||||
<url>https://repo.spring.io/release</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
</repositories> |
||||
<pluginRepositories> |
||||
<pluginRepository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/libs-snapshot-local</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
<pluginRepository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/libs-milestone-local</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
</pluginRepositories> |
||||
</profile> |
||||
</profiles> |
||||
</settings> |
||||
|
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
sudo: false |
||||
cache: |
||||
directories: |
||||
- $HOME/.m2 |
||||
language: java |
||||
before_install: |
||||
- git config user.name "$GIT_NAME" |
||||
- git config user.email "$GIT_EMAIL" |
||||
- git config credential.helper "store --file=.git/credentials" |
||||
- echo "https://$GH_TOKEN:@github.com" > .git/credentials |
||||
- gem install asciidoctor |
||||
install: |
||||
- mvn --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true |
||||
- ./docs/src/main/asciidoc/ghpages.sh |
||||
script: |
||||
- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || mvn --settings .settings.xml deploy |
||||
-nsu -Dmaven.test.redirectTestOutputToFile=true' |
||||
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || mvn --settings .settings.xml install |
||||
-nsu -Dmaven.test.redirectTestOutputToFile=true' |
||||
env: |
||||
global: |
||||
- GIT_NAME="Spencer Gibb" |
||||
- GIT_EMAIL=sgibb@pivotal.io |
||||
- CI_DEPLOY_USERNAME=sgibb |
||||
- secure: WPmrAQJQGBziwGFKwTiDRGrG1nuy9dvoWOQt7WKHW0RBqDbUpZgGeHq6OD2FcE86eRo+tPDihyunsWltei+sfq5bUECkGFQBLGffcTuxyu2j4lTByVazeYKa3en3j7nOiQjI99MqgCHrdyRwtS9EF1SnYXRuSZXwb0Ic8h4Zns4= |
@ -1,202 +0,0 @@
@@ -1,202 +0,0 @@
|
||||
|
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
https://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 |
||||
|
||||
https://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. |
@ -1,19 +1,191 @@
@@ -1,19 +1,191 @@
|
||||
//// |
||||
DO NOT EDIT THIS FILE. IT WAS GENERATED. |
||||
Manual changes to this file will be lost when it is generated again. |
||||
Edit the files in the src/main/asciidoc/ directory instead. |
||||
//// |
||||
// Do not edit this file (e.g. go instead to docs/src/main/asciidoc) |
||||
|
||||
image::https://travis-ci.org/spring-cloud/spring-cloud-commons.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-commons] |
||||
|
||||
|
||||
[[building]] |
||||
= Building |
||||
:page-section-summary-toc: 1 |
||||
https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook[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 https://12factor.net/[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. |
||||
|
||||
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building.adoc[] |
||||
Many of those features are covered by https://projects.spring.io/spring-boot[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). |
||||
|
||||
[[contributing]] |
||||
= Contributing |
||||
:page-section-summary-toc: 1 |
||||
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: |
||||
|
||||
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.adoc[] |
||||
* Java 6 JCE Link https://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html |
||||
* Java 7 JCE Link https://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html |
||||
* Java 8 JCE Link https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html |
||||
|
||||
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using). |
||||
|
||||
== Building |
||||
|
||||
:jdkversion: 1.7 |
||||
|
||||
=== Basic Compile and Test |
||||
|
||||
To build the source you will need to install JDK {jdkversion}. |
||||
|
||||
Spring Cloud uses Maven for most build-related activities, and you |
||||
should be able to get off the ground quite quickly by cloning the |
||||
project you are interested in and typing |
||||
|
||||
---- |
||||
$ ./mvnw install |
||||
---- |
||||
|
||||
NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command |
||||
in place of `./mvnw` in the examples below. If you do that you also |
||||
might need to add `-P spring` if your local Maven settings do not |
||||
contain repository declarations for spring pre-release artifacts. |
||||
|
||||
NOTE: Be aware that you might need to increase the amount of memory |
||||
available to Maven by setting a `MAVEN_OPTS` environment variable with |
||||
a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in |
||||
the `.mvn` configuration, so if you find you have to do it to make a |
||||
build succeed, please raise a ticket to get the settings added to |
||||
source control. |
||||
|
||||
For hints on how to build the project look in `.travis.yml` if there |
||||
is one. There should be a "script" and maybe "install" command. Also |
||||
look at the "services" section to see if any services need to be |
||||
running locally (e.g. mongo or rabbit). Ignore the git-related bits |
||||
that you might find in "before_install" since they're related to setting git |
||||
credentials and you already have those. |
||||
|
||||
The projects that require middleware generally include a |
||||
`docker-compose.yml`, so consider using |
||||
https://compose.docker.io/[Docker Compose] to run the middeware servers |
||||
in Docker containers. See the README in the |
||||
https://github.com/spring-cloud-samples/scripts[scripts demo |
||||
repository] for specific instructions about the common cases of mongo, |
||||
rabbit and redis. |
||||
|
||||
NOTE: If all else fails, build with the command from `.travis.yml` (usually |
||||
`./mvnw install`). |
||||
|
||||
=== Documentation |
||||
|
||||
The spring-cloud-build module has a "docs" profile, and if you switch |
||||
that on it will try to build asciidoc sources from |
||||
`src/main/asciidoc`. As part of that process it will look for a |
||||
`README.adoc` and process it by loading all the includes, but not |
||||
parsing or rendering it, just copying it to `${main.basedir}` |
||||
(defaults to `${basedir}`, i.e. the root of the project). If there are |
||||
any changes in the README it will then show up after a Maven build as |
||||
a modified file in the correct place. Just commit it and push the change. |
||||
|
||||
=== Working with the code |
||||
If you don't have an IDE preference we would recommend that you use |
||||
https://www.springsource.com/developer/sts[Spring Tools Suite] or |
||||
https://eclipse.org[Eclipse] when working with the code. We use the |
||||
https://eclipse.org/m2e/[m2eclipe] eclipse plugin for maven support. Other IDEs and tools |
||||
should also work without issue. |
||||
|
||||
==== Importing into eclipse with m2eclipse |
||||
We recommend the https://eclipse.org/m2e/[m2eclipe] eclipse plugin when working with |
||||
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse |
||||
marketplace". |
||||
|
||||
Unfortunately m2e does not yet support Maven 3.3, so once the projects |
||||
are imported into Eclipse you will also need to tell m2eclipse to use |
||||
the `.settings.xml` file for the projects. If you do not do this you |
||||
may see many different errors related to the POMs in the |
||||
projects. Open your Eclipse preferences, expand the Maven |
||||
preferences, and select User Settings. In the User Settings field |
||||
click Browse and navigate to the Spring Cloud project you imported |
||||
selecting the `.settings.xml` file in that project. Click Apply and |
||||
then OK to save the preference changes. |
||||
|
||||
NOTE: Alternatively you can copy the repository settings from https://github.com/spring-cloud/spring-cloud-build/blob/master/.settings.xml[`.settings.xml`] into your own `~/.m2/settings.xml`. |
||||
|
||||
==== Importing into eclipse without m2eclipse |
||||
If you prefer not to use m2eclipse you can generate eclipse project metadata using the |
||||
following command: |
||||
|
||||
[indent=0] |
||||
---- |
||||
$ ./mvnw eclipse:eclipse |
||||
---- |
||||
|
||||
The generated eclipse projects can be imported by selecting `import existing projects` |
||||
from the `file` menu. |
||||
|
||||
==== Adding Project Lombok Agent |
||||
|
||||
Spring Cloud uses https://projectlombok.org/features/index.html[Project Lombok] |
||||
to generate getters and setters etc. Compiling from the command line this |
||||
shouldn't cause any problems, but in an IDE you need to add an agent |
||||
to the JVM. Full instructions can be found in the Lombok website. The |
||||
sign that you need to do this is a lot of compiler errors to do with |
||||
missing methods and fields, e.g. |
||||
|
||||
[indent=0] |
||||
---- |
||||
The method getInitialStatus() is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 120 Java Problem |
||||
The method getInitialStatus() is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 121 Java Problem |
||||
The method setNonSecurePort(int) is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 112 Java Problem |
||||
The type EurekaInstanceConfigBean.IdentifyingDataCenterInfo must implement the inherited abstract method DataCenterInfo.getName() EurekaInstanceConfigBean.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 131 Java Problem |
||||
The method getId() is undefined for the type ProxyRouteLocator.ProxyRouteSpec PreDecorationFilter.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre line 60 Java Problem |
||||
The method getLocation() is undefined for the type ProxyRouteLocator.ProxyRouteSpec PreDecorationFilter.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre line 55 Java Problem |
||||
---- |
||||
|
||||
==== Importing into Intellij |
||||
Spring Cloud projects use annotation processing, particularly Lombok, which requires configuration |
||||
or you will encounter compile problems. It also needs a specific version of maven and a profile |
||||
enabled. Intellij 14.1+ requires some configuration to ensure these are setup properly. |
||||
|
||||
1. Click Preferences, Plugins. *Ensure Lombok is installed* |
||||
2. Click New, Project from Existing Sources, choose your spring-cloud-sleuth directory |
||||
3. Choose Maven, and select Environment Settings. *Ensure you are using Maven 3.3.3* |
||||
4. In the next screen, *Select the profile `spring`* click Next until Finish. |
||||
5. Click Preferences, "Build, Execution, Deployment", Compiler, Annotation Processors. *Click Enable Annotation Processing* |
||||
6. Click Build, Rebuild Project, and you are ready to go! |
||||
|
||||
==== Importing into other IDEs |
||||
Maven is well supported by most Java IDEs. Refer to you vendor documentation. |
||||
|
||||
|
||||
== Contributing |
||||
|
||||
Spring Cloud is released under the non-restrictive Apache 2.0 license, |
||||
and follows a very standard Github development process, using Github |
||||
tracker for issues and merging pull requests into master. If you want |
||||
to contribute even something trivial please do not hesitate, but |
||||
follow the guidelines below. |
||||
|
||||
=== Sign the Contributor License Agreement |
||||
Before we accept a non-trivial patch or pull request we will need you to sign the |
||||
https://support.springsource.com/spring_committer_signup[contributor's agreement]. |
||||
Signing the contributor's agreement does not grant anyone commit rights to the main |
||||
repository, but it does mean that we can accept your contributions, and you will get an |
||||
author credit if we do. Active contributors might be asked to join the core team, and |
||||
given the ability to merge pull requests. |
||||
|
||||
=== Code of Conduct |
||||
This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of |
||||
conduct]. By participating, you are expected to uphold this code. Please report |
||||
unacceptable behavior to spring-code-of-conduct@pivotal.io. |
||||
|
||||
=== Code Conventions and Housekeeping |
||||
None of these is essential for a pull request, but they will all help. They can also be |
||||
added after the original pull request but before a merge. |
||||
|
||||
* Use the Spring Framework code format conventions. If you use Eclipse |
||||
you can import formatter settings using the |
||||
`eclipse-code-formatter.xml` file from the |
||||
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring |
||||
Cloud Build] project. If using IntelliJ, you can use the |
||||
https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter |
||||
Plugin] to import the same file. |
||||
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an |
||||
`@author` tag identifying you, and preferably at least a paragraph on what the class is |
||||
for. |
||||
* Add the ASF license header comment to all new `.java` files (copy from existing files |
||||
in the project) |
||||
* Add yourself as an `@author` to the .java files that you modify substantially (more |
||||
than cosmetic changes). |
||||
* Add some Javadocs and, if you change the namespace, some XSD doc elements. |
||||
* A few unit tests would help a lot as well -- someone has to do it. |
||||
* If no-one else is using your branch, please rebase it against the current master (or |
||||
other target branch in the main project). |
||||
* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], |
||||
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit |
||||
message (where XXXX is the issue number). |
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
antora: |
||||
extensions: |
||||
- '@springio/antora-extensions/partial-build-extension' |
||||
- require: '@springio/antora-extensions/latest-version-extension' |
||||
- require: '@springio/antora-extensions/inject-collector-cache-config-extension' |
||||
- '@antora/collector-extension' |
||||
- '@antora/atlas-extension' |
||||
- require: '@springio/antora-extensions/root-component-extension' |
||||
root_component_name: 'cloud-commons' |
||||
- '@springio/antora-extensions/static-page-extension' |
||||
site: |
||||
title: Spring Cloud Commons |
||||
url: https://docs.spring.io/spring-cloud-commons/reference/ |
||||
content: |
||||
sources: |
||||
- url: ./.. |
||||
branches: HEAD |
||||
start_path: docs |
||||
worktrees: true |
||||
asciidoc: |
||||
attributes: |
||||
page-stackoverflow-url: https://stackoverflow.com/tags/spring-cloud |
||||
page-pagination: '' |
||||
hide-uri-scheme: '@' |
||||
tabs-sync-option: '@' |
||||
chomp: 'all' |
||||
extensions: |
||||
- '@asciidoctor/tabs' |
||||
- '@springio/asciidoctor-extensions' |
||||
sourcemap: true |
||||
urls: |
||||
latest_version_segment: '' |
||||
runtime: |
||||
log: |
||||
failure_level: warn |
||||
format: pretty |
||||
ui: |
||||
bundle: |
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.2/ui-bundle.zip |
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
name: cloud-commons |
||||
version: true |
||||
title: Spring Cloud Commons |
||||
nav: |
||||
- modules/ROOT/nav.adoc |
||||
ext: |
||||
collector: |
||||
run: |
||||
command: ./mvnw --no-transfer-progress -B process-resources -Pdocs -pl docs -Dantora-maven-plugin.phase=none -Dgenerate-docs.phase=none -Dgenerate-readme.phase=none -Dgenerate-cloud-resources.phase=none -Dmaven-dependency-plugin-for-docs.phase=none -Dmaven-dependency-plugin-for-docs-classes.phase=none -DskipTests |
||||
local: true |
||||
scan: |
||||
dir: ./target/classes/antora-resources/ |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
* xref:index.adoc[] |
||||
** xref:intro.adoc[] |
||||
** xref:spring-cloud-commons/application-context-services.adoc[] |
||||
** xref:spring-cloud-commons/common-abstractions.adoc[] |
||||
** xref:spring-cloud-commons/loadbalancer.adoc[] |
||||
** xref:spring-cloud-commons/cachedrandompropertysource.adoc[] |
||||
** xref:spring-cloud-commons/security.adoc[] |
||||
* xref:spring-cloud-circuitbreaker.adoc[] |
||||
* xref:appendix.adoc[] |
||||
** xref:configprops.adoc[] |
||||
|
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
[appendix] |
||||
[[common-application-properties]] |
||||
= Common application properties |
||||
|
||||
include::partial$_attributes.adoc[] |
||||
|
||||
Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches. |
||||
This appendix provides a list of common {project-full-name} properties and references to the underlying classes that consume them. |
||||
|
||||
NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list. |
||||
Also, you can define your own properties. |
||||
|
||||
[[observability]] |
||||
== Observability metadata |
||||
|
||||
include::partial$_metrics.adoc[] |
||||
|
||||
include::partial$_spans.adoc[] |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
[[configuration-properties]] |
||||
= Configuration Properties |
||||
|
||||
Below you can find a list of configuration properties. |
||||
|
||||
include::partial$_configprops.adoc[] |
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
[[cloud-native-applications]] |
||||
= Cloud Native Applications |
||||
|
||||
include::partial$_attributes.adoc[] |
||||
|
||||
// TODO: figure out remote includes in docs and replace pasted text |
||||
// include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[] |
||||
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, you can find the source code and issue trackers for the project at {github-issues}[github]. |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
[[introduction]] |
||||
= Introduction |
||||
|
||||
https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook[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 https://12factor.net/[12-factor Applications], 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. |
||||
The starting point is a set of features to which all components in a distributed system need easy access. |
||||
|
||||
Many of those features are covered by https://projects.spring.io/spring-boot[Spring Boot], on which Spring Cloud builds. Some more features 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 (such as Spring Cloud Netflix and Spring Cloud Consul). |
||||
|
@ -1,104 +0,0 @@
@@ -1,104 +0,0 @@
|
||||
[[introduction]] |
||||
= Spring Cloud Circuit Breaker |
||||
|
||||
Spring Cloud Circuit breaker provides an abstraction across different circuit breaker implementations. |
||||
It provides a consistent API to use in your applications, letting you, the developer, choose the circuit breaker implementation that best fits your needs for your application. |
||||
|
||||
[[supported-implementations]] |
||||
== Supported Implementations |
||||
|
||||
Spring Cloud supports the following circuit-breaker implementations: |
||||
|
||||
* https://github.com/resilience4j/resilience4j[Resilience4J] |
||||
* https://github.com/alibaba/Sentinel[Sentinel] |
||||
* https://github.com/spring-projects/spring-retry[Spring Retry] |
||||
|
||||
[[core-concepts]] |
||||
== Core Concepts |
||||
|
||||
To create a circuit breaker in your code, you can use the `CircuitBreakerFactory` API. When you include a Spring Cloud Circuit Breaker starter on your classpath, a bean that implements this API is automatically created for you. |
||||
The following example shows a simple example of how to use this API: |
||||
|
||||
[source,java] |
||||
---- |
||||
@Service |
||||
public static class DemoControllerService { |
||||
private RestTemplate rest; |
||||
private CircuitBreakerFactory cbFactory; |
||||
|
||||
public DemoControllerService(RestTemplate rest, CircuitBreakerFactory cbFactory) { |
||||
this.rest = rest; |
||||
this.cbFactory = cbFactory; |
||||
} |
||||
|
||||
public String slow() { |
||||
return cbFactory.create("slow").run(() -> rest.getForObject("/slow", String.class), throwable -> "fallback"); |
||||
} |
||||
|
||||
} |
||||
---- |
||||
|
||||
The `CircuitBreakerFactory.create` API creates an instance of a class called `CircuitBreaker`. |
||||
The `run` method takes a `Supplier` and a `Function`. |
||||
The `Supplier` is the code that you are going to wrap in a circuit breaker. |
||||
The `Function` is the fallback that is run if the circuit breaker is tripped. |
||||
The function is passed the `Throwable` that caused the fallback to be triggered. |
||||
You can optionally exclude the fallback if you do not want to provide one. |
||||
|
||||
[[circuit-breakers-in-reactive-code]] |
||||
=== Circuit Breakers In Reactive Code |
||||
|
||||
If Project Reactor is on the class path, you can also use `ReactiveCircuitBreakerFactory` for your reactive code. |
||||
The following example shows how to do so: |
||||
|
||||
[source,java] |
||||
---- |
||||
@Service |
||||
public static class DemoControllerService { |
||||
private ReactiveCircuitBreakerFactory cbFactory; |
||||
private WebClient webClient; |
||||
|
||||
|
||||
public DemoControllerService(WebClient webClient, ReactiveCircuitBreakerFactory cbFactory) { |
||||
this.webClient = webClient; |
||||
this.cbFactory = cbFactory; |
||||
} |
||||
|
||||
public Mono<String> slow() { |
||||
return webClient.get().uri("/slow").retrieve().bodyToMono(String.class).transform( |
||||
it -> cbFactory.create("slow").run(it, throwable -> return Mono.just("fallback"))); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
The `ReactiveCircuitBreakerFactory.create` API creates an instance of a class called `ReactiveCircuitBreaker`. |
||||
The `run` method takes a `Mono` or a `Flux` and wraps it in a circuit breaker. |
||||
You can optionally profile a fallback `Function`, which will be called if the circuit breaker is tripped and is passed the `Throwable` |
||||
that caused the failure. |
||||
|
||||
[[configuration]] |
||||
== Configuration |
||||
|
||||
You can configure your circuit breakers by creating beans of type `Customizer`. |
||||
The `Customizer` interface has a single method (called `customize`) that takes the `Object` to customize. |
||||
|
||||
For detailed information on how to customize a given implementation see |
||||
the following documentation: |
||||
|
||||
* link:../../../../spring-cloud-circuitbreaker/current/reference/html/spring-cloud-circuitbreaker.html#configuring-resilience4j-circuit-breakers[Resilience4J] |
||||
* link:https://github.com/alibaba/spring-cloud-alibaba/blob/master/spring-cloud-alibaba-docs/src/main/asciidoc/circuitbreaker-sentinel.adoc#circuit-breaker-spring-cloud-circuit-breaker-with-sentinel--configuring-sentinel-circuit-breakers[Sentinel] |
||||
* link:../../../../../spring-cloud-circuitbreaker/docs/current/reference/html/spring-cloud-circuitbreaker.html#configuring-spring-retry-circuit-breakers[Spring Retry] |
||||
|
||||
Some `CircuitBreaker` implementations such as `Resilience4JCircuitBreaker` call `customize` method every time `CircuitBreaker#run` is called. |
||||
It can be inefficient. In that case, you can use `CircuitBreaker#once` method. It is useful where calling `customize` many times doesn't make sense, |
||||
for example, in case of https://resilience4j.readme.io/docs/circuitbreaker#section-consume-emitted-circuitbreakerevents[consuming Resilience4j's events]. |
||||
|
||||
The following example shows the way for each `io.github.resilience4j.circuitbreaker.CircuitBreaker` to consume events. |
||||
|
||||
[source,java] |
||||
---- |
||||
Customizer.once(circuitBreaker -> { |
||||
circuitBreaker.getEventPublisher() |
||||
.onStateTransition(event -> log.info("{}: {}", event.getCircuitBreakerName(), event.getStateTransition())); |
||||
}, CircuitBreaker::getName) |
||||
---- |
@ -1,261 +0,0 @@
@@ -1,261 +0,0 @@
|
||||
[[spring-cloud-context-application-context-services]] |
||||
= 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 files and has endpoints for common management and monitoring tasks. |
||||
Spring Cloud builds on top of that and adds a few features that many components in a system would use or occasionally need. |
||||
|
||||
[[the-bootstrap-application-context]] |
||||
== The Bootstrap Application Context |
||||
|
||||
A Spring Cloud application operates by creating a "`bootstrap`" context, which is a parent context for the main application. |
||||
This context is responsible for loading configuration properties from the external sources and for 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. |
||||
By default, bootstrap properties (not `bootstrap.properties` but properties that are loaded during the bootstrap phase) are added with high precedence, so they cannot be overridden by local configuration. |
||||
|
||||
The bootstrap context uses a different convention for locating external configuration than the main application context. |
||||
Instead of `application.yml` (or `.properties`), you can use `bootstrap.yml`, keeping the external configuration for bootstrap and main context nicely separate. |
||||
The following listing shows an example: |
||||
|
||||
.bootstrap.yml |
||||
---- |
||||
spring: |
||||
application: |
||||
name: foo |
||||
cloud: |
||||
config: |
||||
uri: ${SPRING_CONFIG_URI:http://localhost:8888} |
||||
---- |
||||
|
||||
If your application needs any application-specific configuration from the server, it is a good idea to set the `spring.application.name` (in `bootstrap.yml` or `application.yml`). |
||||
For the property `spring.application.name` to be used as the application's context ID, you must set it in `bootstrap.[properties | yml]`. |
||||
|
||||
If you want to retrieve specific profile configuration, you should also set `spring.profiles.active` in `bootstrap.[properties | yml]`. |
||||
|
||||
You can disable the bootstrap process completely by setting `spring.cloud.bootstrap.enabled=false` (for example, in system properties). |
||||
|
||||
[[application-context-hierarchies]] |
||||
== Application Context Hierarchies |
||||
|
||||
If you build an application context from `SpringApplication` or `SpringApplicationBuilder`, 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 contains additional property sources, compared to building the same context without Spring Cloud Config. |
||||
The additional property sources are: |
||||
|
||||
* "`bootstrap`": If any `PropertySourceLocators` are found in the bootstrap context and if they have non-empty properties, an optional `CompositePropertySource` appears with high priority. |
||||
An example would be properties from the Spring Cloud Config Server. |
||||
See "`xref:spring-cloud-commons/application-context-services.adoc#customizing-bootstrap-property-sources[Customizing the Bootstrap Property Sources]`" for how to customize the contents of this property source. |
||||
|
||||
NOTE: Prior to Spring Cloud 2022.0.3 `PropertySourceLocators` (including the ones for Spring Cloud Config) were run during |
||||
the main application context and not in the Bootstrap context. You can force `PropertySourceLocators` to be run during the |
||||
Bootstrap context by setting `spring.cloud.config.initialize-on-context-refresh=true` in `bootstrap.[properties | yaml]`. |
||||
|
||||
* "`applicationConfig: [classpath:bootstrap.yml]`" (and related files if Spring profiles are active): If you have a `bootstrap.yml` (or `.properties`), those properties are used to configure the bootstrap context. |
||||
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 "`xref:spring-cloud-commons/application-context-services.adoc#customizing-bootstrap-properties[Changing the Location of Bootstrap Properties]`" for how to customize the contents of these property sources. |
||||
|
||||
Because of the ordering rules of property sources, the "`bootstrap`" entries take precedence. |
||||
However, 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 setting the parent context of any `ApplicationContext` you create -- for example, by using its own interface or with the `SpringApplicationBuilder` convenience methods (`parent()`, `child()` and `sibling()`). |
||||
The bootstrap context is the parent of the most senior ancestor that you create yourself. |
||||
Every context in the hierarchy has its own "`bootstrap`" (possibly empty) property source to avoid promoting values inadvertently from parents down to their descendants. |
||||
If there is a config server, every context in the hierarchy can also (in principle) have a different `spring.application.name` and, hence, a different remote property source. |
||||
Normal Spring application context behavior 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 value from the parent is not included in the child). |
||||
|
||||
Note that the `SpringApplicationBuilder` lets you 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 may share common values with their parent. |
||||
|
||||
[[customizing-bootstrap-properties]] |
||||
== Changing the Location of Bootstrap Properties |
||||
|
||||
The `bootstrap.yml` (or `.properties`) location can be specified by setting `spring.cloud.bootstrap.name` (default: `bootstrap`), `spring.cloud.bootstrap.location` (default: empty) or `spring.cloud.bootstrap.additional-location` (default: empty) -- for example, in System properties. |
||||
|
||||
Those properties behave like the `spring.config.*` variants with the same name. |
||||
With `spring.cloud.bootstrap.location` the default locations are replaced and only the specified ones are used. |
||||
To add locations to the list of default ones, `spring.cloud.bootstrap.additional-location` can be used. |
||||
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), properties in that profile get loaded as well, the same as in a regular Spring Boot app -- for example, from `bootstrap-development.properties` for a `development` profile. |
||||
|
||||
[[overriding-bootstrap-properties]] |
||||
== Overriding the Values of Remote Properties |
||||
|
||||
The property sources that are added to your application by the bootstrap context are often "`remote`" (from example, from Spring Cloud Config Server). |
||||
By default, they cannot be overridden locally. |
||||
If you want to let your applications 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 does not work to set this locally). |
||||
Once that flag is set, two finer-grained settings control the location of the remote properties in relation to system properties and the application's local configuration: |
||||
|
||||
* `spring.cloud.config.overrideNone=true`: Override from any local property source. |
||||
* `spring.cloud.config.overrideSystemProperties=false`: Only system properties, command line arguments, and environment variables (but not the local config files) should override the remote settings. |
||||
|
||||
[[customizing-the-bootstrap-configuration]] |
||||
== Customizing the Bootstrap Configuration |
||||
|
||||
The bootstrap context can be set to do anything you like by adding entries to `/META-INF/spring.factories` under a key named `org.springframework.cloud.bootstrap.BootstrapConfiguration`. |
||||
This holds a comma-separated list of Spring `@Configuration` classes that are used to create the context. |
||||
Any beans that you want to be available to the main application context for autowiring can be created here. |
||||
There is a special contract for `@Beans` of type `ApplicationContextInitializer`. |
||||
If you want to control the startup sequence, you can mark classes with the `@Order` annotation (the default order is `last`). |
||||
|
||||
WARNING: When adding custom `BootstrapConfiguration`, be careful 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 and make sure that name is not already covered by your `@ComponentScan` or `@SpringBootApplication` annotated configuration classes. |
||||
|
||||
The bootstrap process ends by injecting initializers into the main `SpringApplication` instance (which is the normal Spring Boot startup sequence, whether it runs as a standalone application or is deployed in an application server). |
||||
First, a bootstrap context is created from the classes found in `spring.factories`. |
||||
Then, all `@Beans` of type `ApplicationContextInitializer` are added to the main `SpringApplication` before it is started. |
||||
|
||||
[[customizing-bootstrap-property-sources]] |
||||
== Customizing the Bootstrap Property Sources |
||||
|
||||
The default property source for external configuration added by the bootstrap process is the Spring Cloud Config Server, but you can add additional sources by adding beans of type `PropertySourceLocator` to the bootstrap context (through `spring.factories`). |
||||
For instance, you can insert additional properties from a different server or from a database. |
||||
|
||||
As an example, consider the following custom locator: |
||||
|
||||
[source,java] |
||||
---- |
||||
@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 -- in other words, the one for which we supply additional property sources. |
||||
It already has its normal Spring Boot-provided property sources, so you can use those to locate a property source specific to this `Environment` (for example, by keying it on `spring.application.name`, as is done in the default Spring Cloud Config Server property source locator). |
||||
|
||||
If you create a jar with this class in it and then add a `META-INF/spring.factories` containing the following setting, the `customProperty` `PropertySource` appears in any application that includes that jar on its classpath: |
||||
|
||||
[source] |
||||
---- |
||||
org.springframework.cloud.bootstrap.BootstrapConfiguration=sample.custom.CustomPropertySourceLocator |
||||
---- |
||||
|
||||
As of Spring Cloud 2022.0.3, Spring Cloud will now call `PropertySourceLocators` twice. The first fetch |
||||
will retrieve any property sources without any profiles. These property sources will have the opportunity to |
||||
activate profiles using `spring.profiles.active`. After the main application context starts `PropertySourceLocators` |
||||
will be called a second time, this time with any active profiles allowing `PropertySourceLocators` to locate |
||||
any additional `PropertySources` with profiles. |
||||
|
||||
[[logging-configuration]] |
||||
== Logging Configuration |
||||
|
||||
If you use Spring Boot to configure log settings, you should place this configuration in `bootstrap.[yml | properties]` if you would like it to apply to all events. |
||||
|
||||
NOTE: For Spring Cloud to initialize logging configuration properly, you cannot use a custom prefix. |
||||
For example, using `custom.loggin.logpath` is not recognized by Spring Cloud when initializing the logging system. |
||||
|
||||
[[environment-changes]] |
||||
== Environment Changes |
||||
|
||||
The application listens for an `EnvironmentChangeEvent` and reacts to the change in a couple of standard ways (additional `ApplicationListeners` can be added as `@Beans` in the normal way). |
||||
When an `EnvironmentChangeEvent` is observed, it has a list of key values that have changed, and the application uses those to: |
||||
|
||||
* Re-bind any `@ConfigurationProperties` beans in the context. |
||||
* Set the logger levels for any properties in `logging.level.*`. |
||||
|
||||
Note that the Spring Cloud Config Client does not, by default, poll for changes in the `Environment`. |
||||
Generally, we would not recommend that approach for detecting changes (although you can set it up with a |
||||
`@Scheduled` annotation). |
||||
If you have a scaled-out client application, it is better to broadcast the `EnvironmentChangeEvent` to all the instances instead of having them polling for changes (for example, by using the https://github.com/spring-cloud/spring-cloud-bus[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. |
||||
Note that those APIs are public and part of core Spring). |
||||
You can verify that the changes are bound to `@ConfigurationProperties` beans by visiting the `/configprops` endpoint (a standard Spring Boot Actuator feature). |
||||
For instance, a `DataSource` can have its `maxPoolSize` changed at runtime (the default `DataSource` created by Spring Boot is a `@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]] |
||||
== Refresh Scope |
||||
|
||||
When there is a configuration change, a Spring `@Bean` that is marked as `@RefreshScope` gets special treatment. |
||||
This feature addresses the problem of stateful beans that get their configuration injected only when they are initialized. |
||||
For instance, if a `DataSource` has open connections when the database URL is changed through the `Environment`, you probably want the holders of those connections to be able to complete what they are doing. |
||||
Then, the next time something borrows a connection from the pool, it gets one with the new URL. |
||||
|
||||
Sometimes, it might even be mandatory to apply the `@RefreshScope` annotation on some beans that can be only initialized once. |
||||
If a bean is "`immutable`", you have to either annotate the bean with `@RefreshScope` or specify the classname under the property key: `spring.cloud.refresh.extra-refreshable`. |
||||
|
||||
WARNING: If you hava a `DataSource` bean that is a `HikariDataSource`, it can not be |
||||
refreshed. It is the default value for `spring.cloud.refresh.never-refreshable`. Choose a |
||||
different `DataSource` implementation if you need it to be refreshed. |
||||
|
||||
Refresh scope beans are lazy proxies that initialize when they are used (that is, when a method is called), and the scope acts as a cache of initialized values. |
||||
To force a bean to re-initialize on the next method call, you must invalidate its cache entry. |
||||
|
||||
The `RefreshScope` is a bean in the context and has a public `refreshAll()` method to refresh all beans in the scope by clearing the target cache. |
||||
The `/refresh` endpoint exposes this functionality (over HTTP or JMX). |
||||
To refresh an individual bean by name, there is also a `refresh(String)` method. |
||||
|
||||
To expose the `/refresh` endpoint, you need to add following configuration to your application: |
||||
|
||||
[source,yaml] |
||||
---- |
||||
management: |
||||
endpoints: |
||||
web: |
||||
exposure: |
||||
include: refresh |
||||
---- |
||||
|
||||
NOTE: `@RefreshScope` works (technically) on a `@Configuration` class, but it might lead to surprising behavior. |
||||
For example, it does not mean that all the `@Beans` defined in that class are themselves in `@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 that case, it is rebuilt on a refresh and its dependencies are re-injected. |
||||
At that point, they are re-initialized from the refreshed `@Configuration`). |
||||
|
||||
NOTE: Removing a configuration value and then performing a refresh will not update the presence of the configuration value. |
||||
The configuration property must be present in order to update the value after a refresh. If you are relying on the presence of |
||||
a value in your application you might want to switch your logic to rely on its absence instead. Another option would be to rely |
||||
on the value changing rather than not being present in the application's configuration. |
||||
|
||||
WARNING: Context Refresh is not supported for Spring AOT transformations and native images. For AOT and native images, `spring.cloud.refresh.enabled` needs to be set to `false`. |
||||
|
||||
[refresh-scope-on-restart] |
||||
=== Refresh Scope on Restart |
||||
|
||||
Seamlessly refreshing beans on restart is especially useful for applications that run with JVM Checkpoint Restore (such as https://github.com/CRaC[Project CRaC]). To allow this ability, we now instantiate a `RefreshScopeLifecycle` bean that triggers Context Refresh on restart, resulting in rebinding configuration properties and refreshing any beans annotated with `@RefreshScope`. You can disable this behavior by setting `spring.cloud.refresh.on-restart.enabled` to `false`. |
||||
|
||||
[[encryption-and-decryption]] |
||||
== Encryption and Decryption |
||||
|
||||
Spring Cloud has an `Environment` pre-processor for decrypting property values locally. |
||||
It follows the same rules as the Spring Cloud Config Server and has the same external configuration through `encrypt.\*`. |
||||
Thus, you can use encrypted values in the form of `\{cipher}*`, and, as long as there is a valid key, they are decrypted before the main application context gets the `Environment` settings. |
||||
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 get an exception due to "Illegal key size" and you use Sun's JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. |
||||
See the following links for more information: |
||||
|
||||
* https://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html[Java 6 JCE] |
||||
* https://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[Java 7 JCE] |
||||
* https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[Java 8 JCE] |
||||
|
||||
Extract the files into the JDK/jre/lib/security folder for whichever version of JRE/JDK x64/x86 you use. |
||||
|
||||
[[endpoints]] |
||||
== Endpoints |
||||
|
||||
For a Spring Boot Actuator application, some additional management endpoints are available. You can use: |
||||
|
||||
* `POST` to `/actuator/env` to update the `Environment` and rebind `@ConfigurationProperties` and log levels. |
||||
To enabled this endpoint you must set `management.endpoint.env.post.enabled=true`. |
||||
* `/actuator/refresh` to re-load the boot strap context and refresh the `@RefreshScope` beans. |
||||
* `/actuator/restart` to close the `ApplicationContext` and restart it (disabled by default). |
||||
* `/actuator/pause` and `/actuator/resume` for calling the `Lifecycle` methods (`stop()` and `start()` on the `ApplicationContext`). |
||||
|
||||
NOTE: While enabling the `POST` method for `/actuator/env` endpoint can provide flexibility and convenience in managing your application environment variables, |
||||
it's critical to ensure that the endpoint is secured and monitored to prevent potential security risks. |
||||
Add a `spring-boot-starter-security` dependency to configure access control for the actuator’s endpoint. |
||||
|
||||
NOTE: If you disable the `/actuator/restart` endpoint then the `/actuator/pause` and `/actuator/resume` endpoints |
||||
will also be disabled since they are just a special case of `/actuator/restart`. |
||||
|
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
[[cachedrandompropertysource]] |
||||
= CachedRandomPropertySource |
||||
:page-section-summary-toc: 1 |
||||
|
||||
Spring Cloud Context provides a `PropertySource` that caches random values based on a key. Outside of the caching |
||||
functionality it works the same as Spring Boot's https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/RandomValuePropertySource.java[`RandomValuePropertySource`]. |
||||
This random value might be useful in the case where you want a random value that is consistent even after the Spring Application |
||||
context restarts. The property value takes the form of `cachedrandom.[yourkey].[type]` where `yourkey` is the key in the cache. The `type` value can |
||||
be any type supported by Spring Boot's `RandomValuePropertySource`. |
||||
|
||||
[source,properties,indent=0] |
||||
---- |
||||
myrandom=${cachedrandom.appname.value} |
||||
---- |
||||
|
@ -1,595 +0,0 @@
@@ -1,595 +0,0 @@
|
||||
[[spring-cloud-common-abstractions]] |
||||
= 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 (for example, discovery with Eureka or Consul). |
||||
|
||||
[[discovery-client]] |
||||
== The `@EnableDiscoveryClient` Annotation |
||||
|
||||
Spring Cloud Commons provides the `@EnableDiscoveryClient` annotation. |
||||
This looks for implementations of the `DiscoveryClient` and `ReactiveDiscoveryClient` interfaces with `META-INF/spring.factories`. |
||||
Implementations of the discovery client add a configuration class to `spring.factories` under the `org.springframework.cloud.client.discovery.EnableDiscoveryClient` key. |
||||
Examples of `DiscoveryClient` implementations include https://cloud.spring.io/spring-cloud-netflix/[Spring Cloud Netflix Eureka], https://cloud.spring.io/spring-cloud-consul/[Spring Cloud Consul Discovery], and https://cloud.spring.io/spring-cloud-zookeeper/[Spring Cloud Zookeeper Discovery]. |
||||
|
||||
Spring Cloud will provide both the blocking and reactive service discovery clients by default. |
||||
You can disable the blocking and/or reactive clients easily by setting `spring.cloud.discovery.blocking.enabled=false` or `spring.cloud.discovery.reactive.enabled=false`. |
||||
To completely disable service discovery you just need to set `spring.cloud.discovery.enabled=false`. |
||||
|
||||
By default, implementations of `DiscoveryClient` auto-register the local Spring Boot server with the remote discovery server. |
||||
This behavior can be disabled by setting `autoRegister=false` in `@EnableDiscoveryClient`. |
||||
|
||||
NOTE: `@EnableDiscoveryClient` is no longer required. |
||||
You can put a `DiscoveryClient` implementation on the classpath to cause the Spring Boot application to register with the service discovery server. |
||||
|
||||
[[health-indicators]] |
||||
=== Health Indicators |
||||
|
||||
Commons auto-configures the following Spring Boot health indicators. |
||||
|
||||
[[discoveryclienthealthindicator]] |
||||
==== DiscoveryClientHealthIndicator |
||||
This health indicator is based on the currently registered `DiscoveryClient` implementation. |
||||
|
||||
* To disable entirely, set `spring.cloud.discovery.client.health-indicator.enabled=false`. |
||||
* To disable the description field, set `spring.cloud.discovery.client.health-indicator.include-description=false`. |
||||
Otherwise, it can bubble up as the `description` of the rolled up `HealthIndicator`. |
||||
* To disable service retrieval, set `spring.cloud.discovery.client.health-indicator.use-services-query=false`. |
||||
By default, the indicator invokes the client's `getServices` method. In deployments with many registered services it may too |
||||
costly to retrieve all services during every check. This will skip the service retrieval and instead use the client's `probe` method. |
||||
|
||||
[[discoverycompositehealthcontributor]] |
||||
==== DiscoveryCompositeHealthContributor |
||||
This composite health indicator is based on all registered `DiscoveryHealthIndicator` beans. To disable, |
||||
set `spring.cloud.discovery.client.composite-indicator.enabled=false`. |
||||
|
||||
[[ordering-discoveryclient-instances]] |
||||
=== Ordering `DiscoveryClient` instances |
||||
`DiscoveryClient` interface extends `Ordered`. This is useful when using multiple discovery |
||||
clients, as it allows you to define the order of the returned discovery clients, similar to |
||||
how you can order the beans loaded by a Spring application. By default, the order of any `DiscoveryClient` is set to |
||||
`0`. If you want to set a different order for your custom `DiscoveryClient` implementations, you just need to override |
||||
the `getOrder()` method so that it returns the value that is suitable for your setup. Apart from this, you can use |
||||
properties to set the order of the `DiscoveryClient` |
||||
implementations provided by Spring Cloud, among others `ConsulDiscoveryClient`, `EurekaDiscoveryClient` and |
||||
`ZookeeperDiscoveryClient`. In order to do it, you just need to set the |
||||
`spring.cloud.\{clientIdentifier}.discovery.order` (or `eureka.client.order` for Eureka) property to the desired value. |
||||
|
||||
[[simplediscoveryclient]] |
||||
=== SimpleDiscoveryClient |
||||
|
||||
If there is no Service-Registry-backed `DiscoveryClient` in the classpath, `SimpleDiscoveryClient` |
||||
instance, that uses properties to get information on service and instances, will be used. |
||||
|
||||
The information about the available instances should be passed to via properties in the following format: |
||||
`spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s11:8080`, where |
||||
`spring.cloud.discovery.client.simple.instances` is the common prefix, then `service1` stands |
||||
for the ID of the service in question, while `[0]` indicates the index number of the instance |
||||
(as visible in the example, indexes start with `0`), and then the value of `uri` is |
||||
the actual URI under which the instance is available. |
||||
|
||||
[[serviceregistry]] |
||||
== ServiceRegistry |
||||
|
||||
Commons now provides a `ServiceRegistry` interface that provides methods such as `register(Registration)` and `deregister(Registration)`, which let you provide custom registered services. |
||||
`Registration` is a marker interface. |
||||
|
||||
The following example shows the `ServiceRegistry` in use: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
@EnableDiscoveryClient(autoRegister=false) |
||||
public class MyConfiguration { |
||||
private ServiceRegistry registry; |
||||
|
||||
public MyConfiguration(ServiceRegistry registry) { |
||||
this.registry = registry; |
||||
} |
||||
|
||||
// called through 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. |
||||
|
||||
* `ZookeeperRegistration` used with `ZookeeperServiceRegistry` |
||||
* `EurekaRegistration` used with `EurekaServiceRegistry` |
||||
* `ConsulRegistration` used with `ConsulServiceRegistry` |
||||
|
||||
If you are using the `ServiceRegistry` interface, you are going to need to pass the |
||||
correct `Registry` implementation for the `ServiceRegistry` implementation you |
||||
are using. |
||||
|
||||
|
||||
[[serviceregistry-auto-registration]] |
||||
=== ServiceRegistry Auto-Registration |
||||
|
||||
By default, the `ServiceRegistry` implementation auto-registers the running service. |
||||
To disable that behavior, you can set: |
||||
* `@EnableDiscoveryClient(autoRegister=false)` to permanently disable auto-registration. |
||||
* `spring.cloud.service-registry.auto-registration.enabled=false` to disable the behavior through configuration. |
||||
|
||||
[[serviceregistry-auto-registration-events]] |
||||
==== ServiceRegistry Auto-Registration Events |
||||
|
||||
There are two events that will be fired when a service auto-registers. The first event, called |
||||
`InstancePreRegisteredEvent`, is fired before the service is registered. The second |
||||
event, called `InstanceRegisteredEvent`, is fired after the service is registered. You can register an |
||||
`ApplicationListener`(s) to listen to and react to these events. |
||||
|
||||
NOTE: These events will not be fired if the `spring.cloud.service-registry.auto-registration.enabled` property is set to `false`. |
||||
|
||||
[[service-registry-actuator-endpoint]] |
||||
=== Service Registry Actuator Endpoint |
||||
|
||||
Spring Cloud Commons provides a `/serviceregistry` actuator endpoint. |
||||
This endpoint relies on a `Registration` bean in the Spring Application Context. |
||||
Calling `/serviceregistry` with GET returns the status of the `Registration`. |
||||
Using POST to the same endpoint with a JSON body changes the status of the current `Registration` to the new value. |
||||
The JSON body has to include the `status` field with the preferred value. |
||||
Please see the documentation of the `ServiceRegistry` implementation you use for the allowed values when updating the status and the values returned for the status. |
||||
For instance, Eureka's supported statuses are `UP`, `DOWN`, `OUT_OF_SERVICE`, and `UNKNOWN`. |
||||
|
||||
[[rest-template-loadbalancer-client]] |
||||
== Spring RestTemplate as a Load Balancer Client |
||||
|
||||
You can configure a `RestTemplate` to use a Load-balancer client. |
||||
To create a load-balanced `RestTemplate`, create a `RestTemplate` `@Bean` and use the `@LoadBalanced` qualifier, as the following example shows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@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; |
||||
} |
||||
} |
||||
---- |
||||
|
||||
CAUTION: A `RestTemplate` bean is no longer created through auto-configuration. |
||||
Individual applications must create it. |
||||
|
||||
The URI needs to use a virtual host name (that is, a service name, not a host name). |
||||
The BlockingLoadBalancerClient is used to create a full physical address. |
||||
|
||||
IMPORTANT: To use a load-balanced `RestTemplate`, you need to have a load-balancer implementation in your classpath. |
||||
Add xref:spring-cloud-commons/loadbalancer.adoc#spring-cloud-loadbalancer-starter[Spring Cloud LoadBalancer starter] to your project in order to use it. |
||||
|
||||
[[webclinet-loadbalancer-client]] |
||||
== Spring WebClient as a Load Balancer Client |
||||
|
||||
You can configure `WebClient` to automatically use a load-balancer client. |
||||
To create a load-balanced `WebClient`, create a `WebClient.Builder` `@Bean` and use the `@LoadBalanced` qualifier, as follows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
public class MyConfiguration { |
||||
|
||||
@Bean |
||||
@LoadBalanced |
||||
public WebClient.Builder loadBalancedWebClientBuilder() { |
||||
return WebClient.builder(); |
||||
} |
||||
} |
||||
|
||||
public class MyClass { |
||||
@Autowired |
||||
private WebClient.Builder webClientBuilder; |
||||
|
||||
public Mono<String> doOtherStuff() { |
||||
return webClientBuilder.build().get().uri("http://stores/stores") |
||||
.retrieve().bodyToMono(String.class); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
The URI needs to use a virtual host name (that is, a service name, not a host name). |
||||
The Spring Cloud LoadBalancer is used to create a full physical address. |
||||
|
||||
IMPORTANT: If you want to use a `@LoadBalanced WebClient.Builder`, you need to have a load balancer |
||||
implementation in the classpath. We recommend that you add the |
||||
xref:spring-cloud-commons/loadbalancer.adoc#spring-cloud-loadbalancer-starter[Spring Cloud LoadBalancer starter] to your project. |
||||
Then, `ReactiveLoadBalancer` is used underneath. |
||||
|
||||
[[retrying-failed-requests]] |
||||
=== Retrying Failed Requests |
||||
|
||||
A load-balanced `RestTemplate` can be configured to retry failed requests. |
||||
By default, this logic is disabled. |
||||
For the non-reactive version (with `RestTemplate`), you can enable it by adding link:https://github.com/spring-projects/spring-retry[Spring Retry] to your application's classpath. For the reactive version (with `WebTestClient`), you need to set `spring.cloud.loadbalancer.retry.enabled=true`. |
||||
|
||||
If you would like to disable the retry logic with Spring Retry or Reactive Retry on the classpath, you can set `spring.cloud.loadbalancer.retry.enabled=false`. |
||||
|
||||
For the non-reactive implementation, if you would like to implement a `BackOffPolicy` in your retries, you need to create a bean of type `LoadBalancedRetryFactory` and override the `createBackOffPolicy()` method. |
||||
|
||||
For the reactive implementation, you just need to enable it by setting `spring.cloud.loadbalancer.retry.backoff.enabled` to `false`. |
||||
|
||||
You can set: |
||||
|
||||
- `spring.cloud.loadbalancer.retry.maxRetriesOnSameServiceInstance` - indicates how many times a request should be retried on the same `ServiceInstance` (counted separately for every selected instance) |
||||
- `spring.cloud.loadbalancer.retry.maxRetriesOnNextServiceInstance` - indicates how many times a request should be retried a newly selected `ServiceInstance` |
||||
- `spring.cloud.loadbalancer.retry.retryableStatusCodes` - the status codes on which to always retry a failed request. |
||||
|
||||
For the reactive implementation, you can additionally set: |
||||
- `spring.cloud.loadbalancer.retry.backoff.minBackoff` - Sets the minimum backoff duration (by default, 5 milliseconds) |
||||
- `spring.cloud.loadbalancer.retry.backoff.maxBackoff` - Sets the maximum backoff duration (by default, max long value of milliseconds) |
||||
- `spring.cloud.loadbalancer.retry.backoff.jitter` - Sets the jitter used for calculating the actual backoff duration for each call (by default, 0.5). |
||||
|
||||
For the reactive implementation, you can also implement your own `LoadBalancerRetryPolicy` to have more detailed control over the load-balanced call retries. |
||||
|
||||
For both implementations, you can also set the exceptions that trigger the replies by adding a list of values under the `spring.cloud.loadbalancer.[serviceId].retry.retryable-exceptions` property. If you do, we make sure to add `RetryableStatusCodeExceptions` to the list of exceptions provided by you, so that we also retry on retryable status codes. If you do not specify any exceptions via properties, the exceptions we use by default are `IOException`, `TimeoutException` and `RetryableStatusCodeException`. You can also enable retrying on all exceptions by setting `spring.cloud.loadbalancer.[serviceId].retry.retry-on-all-exceptions` to `true`. |
||||
|
||||
WARNING: If you use the blocking implementation with Spring Retries, if you want to keep the behaviour from previous releases, set `spring.cloud.loadbalancer.[serviceId].retry.retry-on-all-exceptions` to `true` as that used to be the default mode for the blocking implementation. |
||||
|
||||
NOTE: Individual Loadbalancer clients may be configured individually with the same properties as above except the prefix is `spring.cloud.loadbalancer.clients.<clientId>.*` where `clientId` is the name of the loadbalancer. |
||||
|
||||
NOTE: For load-balanced retries, by default, we wrap the `ServiceInstanceListSupplier` bean with `RetryAwareServiceInstanceListSupplier` to select a different instance from the one previously chosen, if available. You can disable this behavior by setting the value of `spring.cloud.loadbalancer.retry.avoidPreviousInstance` to `false`. |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
public class MyConfiguration { |
||||
@Bean |
||||
LoadBalancedRetryFactory retryFactory() { |
||||
return new LoadBalancedRetryFactory() { |
||||
@Override |
||||
public BackOffPolicy createBackOffPolicy(String service) { |
||||
return new ExponentialBackOffPolicy(); |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
---- |
||||
|
||||
If you want to add one or more `RetryListener` implementations to your retry functionality, you need to |
||||
create a bean of type `LoadBalancedRetryListenerFactory` and return the `RetryListener` array |
||||
you would like to use for a given service, as the following example shows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
public class MyConfiguration { |
||||
@Bean |
||||
LoadBalancedRetryListenerFactory retryListenerFactory() { |
||||
return new LoadBalancedRetryListenerFactory() { |
||||
@Override |
||||
public RetryListener[] createRetryListeners(String service) { |
||||
return new RetryListener[]{new RetryListener() { |
||||
@Override |
||||
public <T, E extends Throwable> boolean open(RetryContext context, RetryCallback<T, E> callback) { |
||||
//TODO Do you business... |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) { |
||||
//TODO Do you business... |
||||
} |
||||
|
||||
@Override |
||||
public <T, E extends Throwable> void onError(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) { |
||||
//TODO Do you business... |
||||
} |
||||
}}; |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
---- |
||||
|
||||
[[multiple-resttemplate-objects]] |
||||
== Multiple `RestTemplate` Objects |
||||
|
||||
If you want a `RestTemplate` that is not load-balanced, create a `RestTemplate` bean and inject it. |
||||
To access the load-balanced `RestTemplate`, use the `@LoadBalanced` qualifier when you create your `@Bean`, as the following example shows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@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); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
IMPORTANT: Notice the use of the `@Primary` annotation on the plain `RestTemplate` declaration in the preceding example to disambiguate the unqualified `@Autowired` injection. |
||||
|
||||
TIP: If you see errors such as `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` or setting `spring.aop.proxyTargetClass=true`. |
||||
|
||||
[[multiple-webclient-objects]] |
||||
== Multiple WebClient Objects |
||||
|
||||
If you want a `WebClient` that is not load-balanced, create a `WebClient` bean and inject it. |
||||
To access the load-balanced `WebClient`, use the `@LoadBalanced` qualifier when you create your `@Bean`, as the following example shows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
public class MyConfiguration { |
||||
|
||||
@LoadBalanced |
||||
@Bean |
||||
WebClient.Builder loadBalanced() { |
||||
return WebClient.builder(); |
||||
} |
||||
|
||||
@Primary |
||||
@Bean |
||||
WebClient.Builder webClient() { |
||||
return WebClient.builder(); |
||||
} |
||||
} |
||||
|
||||
public class MyClass { |
||||
@Autowired |
||||
private WebClient.Builder webClientBuilder; |
||||
|
||||
@Autowired |
||||
@LoadBalanced |
||||
private WebClient.Builder loadBalanced; |
||||
|
||||
public Mono<String> doOtherStuff() { |
||||
return loadBalanced.build().get().uri("http://stores/stores") |
||||
.retrieve().bodyToMono(String.class); |
||||
} |
||||
|
||||
public Mono<String> doStuff() { |
||||
return webClientBuilder.build().get().uri("http://example.com") |
||||
.retrieve().bodyToMono(String.class); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
[[loadbalanced-webclient]] |
||||
== Spring WebFlux `WebClient` as a Load Balancer Client |
||||
|
||||
The Spring WebFlux can work with both reactive and non-reactive `WebClient` configurations, as the topics describe: |
||||
|
||||
* xref:spring-cloud-commons/common-abstractions.adoc#webflux-with-reactive-loadbalancer[Spring WebFlux `WebClient` with `ReactorLoadBalancerExchangeFilterFunction`] |
||||
* xref:spring-cloud-commons/common-abstractions.adoc#load-balancer-exchange-filter-function[Spring WebFlux `WebClient` with a Non-reactive Load Balancer Client] |
||||
|
||||
[[webflux-with-reactive-loadbalancer]] |
||||
=== Spring WebFlux `WebClient` with `ReactorLoadBalancerExchangeFilterFunction` |
||||
|
||||
You can configure `WebClient` to use the `ReactiveLoadBalancer`. |
||||
If you add xref:spring-cloud-commons/loadbalancer.adoc#spring-cloud-loadbalancer-starter[Spring Cloud LoadBalancer starter] to your project |
||||
and if `spring-webflux` is on the classpath, `ReactorLoadBalancerExchangeFilterFunction` is auto-configured. |
||||
The following example shows how to configure a `WebClient` to use reactive load-balancer: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
public class MyClass { |
||||
@Autowired |
||||
private ReactorLoadBalancerExchangeFilterFunction lbFunction; |
||||
|
||||
public Mono<String> doOtherStuff() { |
||||
return WebClient.builder().baseUrl("http://stores") |
||||
.filter(lbFunction) |
||||
.build() |
||||
.get() |
||||
.uri("/stores") |
||||
.retrieve() |
||||
.bodyToMono(String.class); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
The URI needs to use a virtual host name (that is, a service name, not a host name). |
||||
The `ReactorLoadBalancer` is used to create a full physical address. |
||||
|
||||
[[load-balancer-exchange-filter-function]] |
||||
=== Spring WebFlux `WebClient` with a Non-reactive Load Balancer Client |
||||
|
||||
If `spring-webflux` is on the classpath, `LoadBalancerExchangeFilterFunction` |
||||
is auto-configured. Note, however, that this |
||||
uses a non-reactive client under the hood. |
||||
The following example shows how to configure a `WebClient` to use load-balancer: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
public class MyClass { |
||||
@Autowired |
||||
private LoadBalancerExchangeFilterFunction lbFunction; |
||||
|
||||
public Mono<String> doOtherStuff() { |
||||
return WebClient.builder().baseUrl("http://stores") |
||||
.filter(lbFunction) |
||||
.build() |
||||
.get() |
||||
.uri("/stores") |
||||
.retrieve() |
||||
.bodyToMono(String.class); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
The URI needs to use a virtual host name (that is, a service name, not a host name). |
||||
The `LoadBalancerClient` is used to create a full physical address. |
||||
|
||||
WARN: This approach is now deprecated. |
||||
We suggest that you use xref:spring-cloud-commons/common-abstractions.adoc#webflux-with-reactive-loadbalancer[WebFlux with reactive Load-Balancer] |
||||
instead. |
||||
|
||||
[[ignore-network-interfaces]] |
||||
== Ignore Network Interfaces |
||||
|
||||
Sometimes, it is useful to ignore certain named network interfaces so that they can be excluded from Service Discovery registration (for example, when running in a Docker container). |
||||
A list of regular expressions can be set to cause the desired network interfaces to be ignored. |
||||
The following configuration ignores the `docker0` interface and all interfaces that start with `veth`: |
||||
|
||||
.application.yml |
||||
---- |
||||
spring: |
||||
cloud: |
||||
inetutils: |
||||
ignoredInterfaces: |
||||
- docker0 |
||||
- veth.* |
||||
---- |
||||
|
||||
You can also force the use of only specified network addresses by using a list of regular expressions, as the following example shows: |
||||
|
||||
.bootstrap.yml |
||||
---- |
||||
spring: |
||||
cloud: |
||||
inetutils: |
||||
preferredNetworks: |
||||
- 192.168 |
||||
- 10.0 |
||||
---- |
||||
|
||||
You can also force the use of only site-local addresses, as the following example shows: |
||||
|
||||
.application.yml |
||||
---- |
||||
spring: |
||||
cloud: |
||||
inetutils: |
||||
useOnlySiteLocalInterfaces: true |
||||
---- |
||||
|
||||
See https://docs.oracle.com/javase/8/docs/api/java/net/Inet4Address.html#isSiteLocalAddress--[Inet4Address.html.isSiteLocalAddress()] for more details about what constitutes a site-local address. |
||||
|
||||
[[http-clients]] |
||||
== HTTP Client Factories |
||||
|
||||
Spring Cloud Commons provides beans for creating both Apache HTTP clients (`ApacheHttpClientFactory`) and OK HTTP clients (`OkHttpClientFactory`). |
||||
The `OkHttpClientFactory` bean is created only 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. |
||||
If you would like to customize how the HTTP clients are created in downstream projects, you can provide your own implementation of these beans. |
||||
In addition, if you provide a bean of type `HttpClientBuilder` or `OkHttpClient.Builder`, the default factories use these builders as the basis for the builders returned to 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`. |
||||
|
||||
[[enabled-features]] |
||||
== Enabled Features |
||||
|
||||
Spring Cloud Commons provides a `/features` actuator endpoint. |
||||
This endpoint returns features available on the classpath and whether they are enabled. |
||||
The information returned includes the feature type, name, version, and vendor. |
||||
|
||||
[[feature-types]] |
||||
=== Feature types |
||||
|
||||
There are two types of 'features': abstract and named. |
||||
|
||||
Abstract features are features where an interface or abstract class is defined and that an implementation the creates, such as `DiscoveryClient`, `LoadBalancerClient`, or `LockService`. |
||||
The abstract class or interface is used to find a bean of that type in the context. |
||||
The version displayed is `bean.getClass().getPackage().getImplementationVersion()`. |
||||
|
||||
Named features are features that do not have a particular class they implement. These features include "`Circuit Breaker`", "`API Gateway`", "`Spring Cloud Bus`", and others. These features require a name and a bean type. |
||||
|
||||
[[declaring-features]] |
||||
=== Declaring features |
||||
|
||||
Any module can declare any number of `HasFeature` beans, as the following examples show: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Bean |
||||
public HasFeatures commonsFeatures() { |
||||
return HasFeatures.abstractFeatures(DiscoveryClient.class, LoadBalancerClient.class); |
||||
} |
||||
|
||||
@Bean |
||||
public HasFeatures consulFeatures() { |
||||
return HasFeatures.namedFeatures( |
||||
new NamedFeature("Spring Cloud Bus", ConsulBusAutoConfiguration.class), |
||||
new NamedFeature("Circuit Breaker", HystrixCommandAspect.class)); |
||||
} |
||||
|
||||
@Bean |
||||
HasFeatures localFeatures() { |
||||
return HasFeatures.builder() |
||||
.abstractFeature(Something.class) |
||||
.namedFeature(new NamedFeature("Some Other Feature", Someother.class)) |
||||
.abstractFeature(Somethingelse.class) |
||||
.build(); |
||||
} |
||||
---- |
||||
|
||||
Each of these beans should go in an appropriately guarded `@Configuration`. |
||||
|
||||
|
||||
[[spring-cloud-compatibility-verification]] |
||||
== Spring Cloud Compatibility Verification |
||||
|
||||
Due to the fact that some users have problem with setting up Spring Cloud application, we've decided |
||||
to add a compatibility verification mechanism. It will break if your current setup is not compatible |
||||
with Spring Cloud requirements, together with a report, showing what exactly went wrong. |
||||
|
||||
At the moment we verify which version of Spring Boot is added to your classpath. |
||||
|
||||
Example of a report |
||||
|
||||
---- |
||||
*************************** |
||||
APPLICATION FAILED TO START |
||||
*************************** |
||||
|
||||
Description: |
||||
|
||||
Your project setup is incompatible with our requirements due to following reasons: |
||||
|
||||
- Spring Boot [2.1.0.RELEASE] is not compatible with this Spring Cloud release train |
||||
|
||||
|
||||
Action: |
||||
|
||||
Consider applying the following actions: |
||||
|
||||
- Change Spring Boot version to one of the following versions [1.2.x, 1.3.x] . |
||||
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn]. |
||||
If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section. |
||||
---- |
||||
|
||||
In order to disable this feature, set `spring.cloud.compatibility-verifier.enabled` to `false`. |
||||
If you want to override the compatible Spring Boot versions, just set the |
||||
`spring.cloud.compatibility-verifier.compatible-boot-versions` property with a comma separated list |
||||
of compatible Spring Boot versions. |
||||
|
@ -1,515 +0,0 @@
@@ -1,515 +0,0 @@
|
||||
[[spring-cloud-loadbalancer]] |
||||
= Spring Cloud LoadBalancer |
||||
|
||||
Spring Cloud provides its own client-side load-balancer abstraction and implementation. For the load-balancing |
||||
mechanism, `ReactiveLoadBalancer` interface has been added and a *Round-Robin-based* and *Random* implementations |
||||
have been provided for it. In order to get instances to select from reactive `ServiceInstanceListSupplier` |
||||
is used. Currently we support a service-discovery-based implementation of `ServiceInstanceListSupplier` |
||||
that retrieves available instances from Service Discovery using a xref:spring-cloud-commons/common-abstractions.adoc#discovery-client[Discovery Client] available in the classpath. |
||||
|
||||
TIP: It is possible to disable Spring Cloud LoadBalancer by setting the value of `spring.cloud.loadbalancer.enabled` to `false`. |
||||
|
||||
[[eager-loading-of-loadbalancer-contexts]] |
||||
== Eager loading of LoadBalancer contexts |
||||
|
||||
Spring Cloud LoadBalancer creates a separate Spring child context for each service id. By default, these contexts are initialised lazily, whenever the first request for a service id is being load-balanced. |
||||
|
||||
You can choose to load those contexts eagerly. In order to do that, specify the service ids for which you want to do eager load using the `spring.cloud-loadbalancer.eager-load.clients` property. |
||||
|
||||
[[switching-between-the-load-balancing-algorithms]] |
||||
== Switching between the load-balancing algorithms |
||||
|
||||
The `ReactiveLoadBalancer` implementation that is used by default is `RoundRobinLoadBalancer`. To switch to a different implementation, either for selected services or all of them, you can use the xref:spring-cloud-commons/loadbalancer.adoc#custom-loadbalancer-configuration[custom LoadBalancer configurations mechanism]. |
||||
|
||||
For example, the following configuration can be passed via `@LoadBalancerClient` annotation to switch to using the `RandomLoadBalancer`: |
||||
|
||||
[[random-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
ReactorLoadBalancer<ServiceInstance> randomLoadBalancer(Environment environment, |
||||
LoadBalancerClientFactory loadBalancerClientFactory) { |
||||
String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME); |
||||
return new RandomLoadBalancer(loadBalancerClientFactory |
||||
.getLazyProvider(name, ServiceInstanceListSupplier.class), |
||||
name); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
NOTE: The classes you pass as `@LoadBalancerClient` or `@LoadBalancerClients` configuration arguments should either not be annotated with `@Configuration` or be outside component scan scope. |
||||
|
||||
[[spring-cloud-loadbalancer-integrations]] |
||||
== Spring Cloud LoadBalancer integrations |
||||
|
||||
In order to make it easy to use Spring Cloud LoadBalancer, we provide `ReactorLoadBalancerExchangeFilterFunction` that can be used with `WebClient` and `BlockingLoadBalancerClient` that works with `RestTemplate`. |
||||
You can see more information and examples of usage in the following sections: |
||||
|
||||
* xref:spring-cloud-commons/common-abstractions.adoc#rest-template-loadbalancer-client[Spring RestTemplate as a Load Balancer Client] |
||||
* xref:spring-cloud-commons/common-abstractions.adoc#webclinet-loadbalancer-client[Spring WebClient as a Load Balancer Client] |
||||
* xref:spring-cloud-commons/common-abstractions.adoc#webflux-with-reactive-loadbalancer[Spring WebFlux WebClient with `ReactorLoadBalancerExchangeFilterFunction`] |
||||
|
||||
[[loadbalancer-caching]] |
||||
== Spring Cloud LoadBalancer Caching |
||||
|
||||
Apart from the basic `ServiceInstanceListSupplier` implementation that retrieves instances via `DiscoveryClient` each time it has to choose an instance, we provide two caching implementations. |
||||
|
||||
[[https://github-com/ben-manes/caffeine[caffeine]-backed-loadbalancer-cache-implementation]] |
||||
=== https://github.com/ben-manes/caffeine[Caffeine]-backed LoadBalancer Cache Implementation |
||||
|
||||
If you have `com.github.ben-manes.caffeine:caffeine` in the classpath, Caffeine-based implementation will be used. |
||||
See the xref:spring-cloud-commons/loadbalancer.adoc#loadbalancer-cache-configuration[LoadBalancerCacheConfiguration] section for information on how to configure it. |
||||
|
||||
If you are using Caffeine, you can also override the default Caffeine Cache setup for the LoadBalancer by passing your own https://static.javadoc.io/com.github.ben-manes.caffeine/caffeine/2.2.2/com/github/benmanes/caffeine/cache/CaffeineSpec.html[Caffeine Specification] |
||||
in the `spring.cloud.loadbalancer.cache.caffeine.spec` property. |
||||
|
||||
WARN: Passing your own Caffeine specification will override any other LoadBalancerCache settings, including xref:spring-cloud-commons/loadbalancer.adoc#loadbalancer-cache-configuration[General LoadBalancer Cache Configuration] fields, such as `ttl` and `capacity`. |
||||
|
||||
[[default-loadbalancer-cache-implementation]] |
||||
=== Default LoadBalancer Cache Implementation |
||||
|
||||
If you do not have Caffeine in the classpath, the `DefaultLoadBalancerCache`, which comes automatically with `spring-cloud-starter-loadbalancer`, will be used. |
||||
See the xref:spring-cloud-commons/loadbalancer.adoc#loadbalancer-cache-configuration[LoadBalancerCacheConfiguration] section for information on how to configure it. |
||||
|
||||
TIP: To use Caffeine instead of the default cache, add the `com.github.ben-manes.caffeine:caffeine` dependency to classpath. |
||||
|
||||
[[loadbalancer-cache-configuration]] |
||||
=== LoadBalancer Cache Configuration |
||||
|
||||
You can set your own `ttl` value (the time after write after which entries should be expired), expressed as `Duration`, by passing a `String` compliant with the https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-conversion-duration[Spring Boot `String` to `Duration` converter syntax]. |
||||
as the value of the `spring.cloud.loadbalancer.cache.ttl` property. |
||||
You can also set your own LoadBalancer cache initial capacity by setting the value of the `spring.cloud.loadbalancer.cache.capacity` property. |
||||
|
||||
The default setup includes `ttl` set to 35 seconds and the default `initialCapacity` is `256`. |
||||
|
||||
You can also altogether disable loadBalancer caching by setting the value of `spring.cloud.loadbalancer.cache.enabled` |
||||
to `false`. |
||||
|
||||
WARNING: Although the basic, non-cached, implementation is useful for prototyping and testing, it's much less efficient than the cached versions, so we recommend always using the cached version in production. If the caching is already done by the `DiscoveryClient` implementation, for example `EurekaDiscoveryClient`, the load-balancer caching should be disabled to prevent double caching. |
||||
|
||||
NOTE: When you create your own configuration, if you use `CachingServiceInstanceListSupplier` make sure to place it in the hierarchy directly after the supplier that retrieves the instances over the network, for example, `DiscoveryClientServiceInstanceListSupplier`, before any other filtering suppliers. |
||||
|
||||
[[weighted-load-balancing]] |
||||
== Weighted Load-Balancing |
||||
|
||||
To enable weighted load-balancing, we provide the `WeightedServiceInstanceListSupplier`. We use `WeightFunction` to calculate the weight of each instance. |
||||
By default, we try to read and parse the weight from the metadata map (the key is `weight`). |
||||
|
||||
If the weight is not specified in the metadata map, we default the weight of this instance to be 1. |
||||
|
||||
You can configure it either by setting the value of `spring.cloud.loadbalancer.configurations` to `weighted` or by providing your own `ServiceInstanceListSupplier` bean, for example: |
||||
|
||||
[[weighted-custom-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withWeighted() |
||||
.withCaching() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
NOTE: You can also customize the weight calculation logic by providing `WeightFunction`. |
||||
|
||||
You can use this sample configuration to make all instances have a random weight: |
||||
|
||||
[[random-weight-weighted-custom-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withWeighted(instance -> ThreadLocalRandom.current().nextInt(1, 101)) |
||||
.withCaching() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
[[zone-based-load-balancing]] |
||||
== Zone-Based Load-Balancing |
||||
|
||||
To enable zone-based load-balancing, we provide the `ZonePreferenceServiceInstanceListSupplier`. |
||||
We use `DiscoveryClient`-specific `zone` configuration (for example, `eureka.instance.metadata-map.zone`) to pick the zone that the client tries to filter available service instances for. |
||||
|
||||
NOTE: You can also override `DiscoveryClient`-specific zone setup by setting the value of `spring.cloud.loadbalancer.zone` property. |
||||
|
||||
WARNING: For the time being, only Eureka Discovery Client is instrumented to set the LoadBalancer zone. For other discovery client, set the `spring.cloud.loadbalancer.zone` property. More instrumentations coming shortly. |
||||
|
||||
NOTE: To determine the zone of a retrieved `ServiceInstance`, we check the value under the `"zone"` key in its metadata map. |
||||
|
||||
The `ZonePreferenceServiceInstanceListSupplier` filters retrieved instances and only returns the ones within the same zone. |
||||
If the zone is `null` or there are no instances within the same zone, it returns all the retrieved instances. |
||||
|
||||
In order to use the zone-based load-balancing approach, you will have to instantiate a `ZonePreferenceServiceInstanceListSupplier` bean in a xref:spring-cloud-commons/loadbalancer.adoc#custom-loadbalancer-configuration[custom configuration]. |
||||
|
||||
We use delegates to work with `ServiceInstanceListSupplier` beans. |
||||
We suggest using a `DiscoveryClientServiceInstanceListSupplier` delegate, wrapping it with a `CachingServiceInstanceListSupplier` to leverage xref:spring-cloud-commons/loadbalancer.adoc#loadbalancer-caching[LoadBalancer caching mechanism], and then passing the resulting bean in the constructor of `ZonePreferenceServiceInstanceListSupplier`. |
||||
|
||||
You can use this sample configuration to set it up: |
||||
|
||||
[[zoned-based-custom-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withCaching() |
||||
.withZonePreference() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
[[instance-health-check-for-loadbalancer]] |
||||
== Instance Health-Check for LoadBalancer |
||||
|
||||
It is possible to enable a scheduled HealthCheck for the LoadBalancer. The `HealthCheckServiceInstanceListSupplier` |
||||
is provided for that. It regularly verifies if the instances provided by a delegate |
||||
`ServiceInstanceListSupplier` are still alive and only returns the healthy instances, |
||||
unless there are none - then it returns all the retrieved instances. |
||||
|
||||
TIP: This mechanism is particularly helpful while using the `SimpleDiscoveryClient`. For the |
||||
clients backed by an actual Service Registry, it's not necessary to use, as we already get |
||||
healthy instances after querying the external ServiceDiscovery. |
||||
|
||||
TIP: This supplier is also recommended for setups with a small number of instances per service |
||||
in order to avoid retrying calls on a failing instance. |
||||
|
||||
WARNING: If using any of the Service Discovery-backed suppliers, adding this health-check mechanism is usually not necessary, as we retrieve the health state of the instances directly |
||||
from the Service Registry. |
||||
|
||||
TIP: The `HealthCheckServiceInstanceListSupplier` relies on having updated instances provided by a delegate flux. In the rare cases when you want to use a delegate that does not refresh the instances, even though the list of instances may change (such as the `DiscoveryClientServiceInstanceListSupplier` provided by us), you can set `spring.cloud.loadbalancer.health-check.refetch-instances` to `true` to have the instance list refreshed by the `HealthCheckServiceInstanceListSupplier`. You can then also adjust the refretch intervals by modifying the value of `spring.cloud.loadbalancer.health-check.refetch-instances-interval` and opt to disable the additional healthcheck repetitions by setting `spring.cloud.loadbalancer.health-check.repeat-health-check` to `false` as every instances refetch |
||||
will also trigger a healthcheck. |
||||
|
||||
`HealthCheckServiceInstanceListSupplier` uses properties prefixed with |
||||
`spring.cloud.loadbalancer.health-check`. You can set the `initialDelay` and `interval` |
||||
for the scheduler. You can set the default path for the healthcheck URL by setting |
||||
the value of the `spring.cloud.loadbalancer.health-check.path.default` property. You can also set a specific value for any given service by setting the value of the `spring.cloud.loadbalancer.health-check.path.[SERVICE_ID]` property, substituting `[SERVICE_ID]` with the correct ID of your service. If the `[SERVICE_ID]` is not specified, `/actuator/health` is used by default. If the `[SERVICE_ID]` is set to `null` or empty as a value, then the health check will not be executed. You can also set a custom port for health-check requests by setting the value of `spring.cloud.loadbalancer.health-check.port`. If none is set, the port under which the requested service is available at the service instance. |
||||
|
||||
TIP: If you rely on the default path (`/actuator/health`), make sure you add `spring-boot-starter-actuator` to your collaborator's dependencies, unless you are planning to add such an endpoint on your own. |
||||
|
||||
TIP: By default, the `healthCheckFlux` will emit on each alive `ServiceInstance` that has been retrieved. You can modify this behaviour by setting the value of `spring.cloud.loadbalancer.health-check.update-results-list` to `false`. If this property is set to `false`, the entire alive instances sequence is first collected into a list and only then emitted, which ensures the flux does not emit values in between the health-check intervals set in properties. |
||||
|
||||
In order to use the health-check scheduler approach, you will have to instantiate a `HealthCheckServiceInstanceListSupplier` bean in a xref:spring-cloud-commons/loadbalancer.adoc#custom-loadbalancer-configuration[custom configuration]. |
||||
|
||||
We use delegates to work with `ServiceInstanceListSupplier` beans. |
||||
We suggest passing a `DiscoveryClientServiceInstanceListSupplier` delegate in the constructor of `HealthCheckServiceInstanceListSupplier`. |
||||
|
||||
You can use this sample configuration to set it up: |
||||
|
||||
[[health-check-based-custom-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withHealthChecks() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
TIP: For the non-reactive stack, create this supplier with the `withBlockingHealthChecks()`. |
||||
You can also pass your own `WebClient` or `RestTemplate` instance to be used for the checks. |
||||
|
||||
WARNING: `HealthCheckServiceInstanceListSupplier` has its own caching mechanism based on Reactor Flux `replay()`. Therefore, if it's being used, you may want to skip wrapping that supplier with `CachingServiceInstanceListSupplier`. |
||||
|
||||
NOTE: When you create your own configuration, `HealthCheckServiceInstanceListSupplier`, make sure to place it in the hierarchy directly after the supplier that retrieves the instances over the network, for example, `DiscoveryClientServiceInstanceListSupplier`, before any other filtering suppliers. |
||||
|
||||
[[same-instance-preference-for-loadbalancer]] |
||||
== Same instance preference for LoadBalancer |
||||
|
||||
You can set up the LoadBalancer in such a way that it prefers the instance that was previously selected, if that instance is available. |
||||
|
||||
For that, you need to use `SameInstancePreferenceServiceInstanceListSupplier`. You can configure it either by setting the value of `spring.cloud.loadbalancer.configurations` to `same-instance-preference` or by providing your own `ServiceInstanceListSupplier` bean -- for example: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withSameInstancePreference() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
TIP: This is also a replacement for Zookeeper `StickyRule`. |
||||
|
||||
[[request-based-sticky-session-for-loadbalancer]] |
||||
== Request-based Sticky Session for LoadBalancer |
||||
|
||||
You can set up the LoadBalancer in such a way that it prefers the instance with `instanceId` provided in a request cookie. We currently support this if the request is being passed to the LoadBalancer through either `ClientRequestContext` or `ServerHttpRequestContext`, which are used by the SC LoadBalancer exchange filter functions and filters. |
||||
|
||||
For that, you need to use the `RequestBasedStickySessionServiceInstanceListSupplier`. You can configure it either by setting the value of `spring.cloud.loadbalancer.configurations` to `request-based-sticky-session` or by providing your own `ServiceInstanceListSupplier` bean -- for example: |
||||
|
||||
[[health-check-based-custom-loadbalancer-configuration-example]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withRequestBasedStickySession() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
For that functionality, it is useful to have the selected service instance (which can be different from the one in the original request cookie if that one is not available) to be updated before sending the request forward. To do that, set the value of `spring.cloud.loadbalancer.sticky-session.add-service-instance-cookie` to `true`. |
||||
|
||||
By default, the name of the cookie is `sc-lb-instance-id`. You can modify it by changing the value of the `spring.cloud.loadbalancer.instance-id-cookie-name` property. |
||||
|
||||
NOTE: This feature is currently supported for WebClient-backed load-balancing. |
||||
|
||||
[[spring-cloud-loadbalancer-hints]] |
||||
== Spring Cloud LoadBalancer Hints |
||||
|
||||
Spring Cloud LoadBalancer lets you set `String` hints that are passed to the LoadBalancer within the `Request` object and that can later be used in `ReactiveLoadBalancer` implementations that can handle them. |
||||
|
||||
You can set a default hint for all services by setting the value of the `spring.cloud.loadbalancer.hint.default` property. You can also set a specific value |
||||
for any given service by setting the value of the `spring.cloud.loadbalancer.hint.[SERVICE_ID]` property, substituting `[SERVICE_ID]` with the correct ID of your service. If the hint is not set by the user, `default` is used. |
||||
|
||||
[[hints-based-loadbalancing]] |
||||
== Hint-Based Load-Balancing |
||||
|
||||
We also provide a `HintBasedServiceInstanceListSupplier`, which is a `ServiceInstanceListSupplier` implementation for hint-based instance selection. |
||||
|
||||
`HintBasedServiceInstanceListSupplier` checks for a hint request header (the default header-name is `X-SC-LB-Hint`, but you can modify it by changing the value of the `spring.cloud.loadbalancer.hint-header-name` property) and, if it finds a hint request header, uses the hint value passed in the header to filter service instances. |
||||
|
||||
If no hint header has been added, `HintBasedServiceInstanceListSupplier` uses xref:spring-cloud-commons/loadbalancer.adoc#spring-cloud-loadbalancer-hints[hint values from properties] to filter service instances. |
||||
|
||||
If no hint is set, either by the header or by properties, all service instances provided by the delegate are returned. |
||||
|
||||
While filtering, `HintBasedServiceInstanceListSupplier` looks for service instances that have a matching value set under the `hint` key in their `metadataMap`. If no matching instances are found, all instances provided by the delegate are returned. |
||||
|
||||
You can use the following sample configuration to set it up: |
||||
|
||||
[[hints-based-custom-loadbalancer-configuration]] |
||||
[source,java,indent=0] |
||||
---- |
||||
public class CustomLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( |
||||
ConfigurableApplicationContext context) { |
||||
return ServiceInstanceListSupplier.builder() |
||||
.withDiscoveryClient() |
||||
.withCaching() |
||||
.withHints() |
||||
.build(context); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
[[transform-the-load-balanced-http-request]] |
||||
== Transform the load-balanced HTTP request |
||||
|
||||
You can use the selected `ServiceInstance` to transform the load-balanced HTTP Request. |
||||
|
||||
For `RestTemplate`, you need to implement and define `LoadBalancerRequestTransformer` as follows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Bean |
||||
public LoadBalancerRequestTransformer transformer() { |
||||
return new LoadBalancerRequestTransformer() { |
||||
@Override |
||||
public HttpRequest transformRequest(HttpRequest request, ServiceInstance instance) { |
||||
return new HttpRequestWrapper(request) { |
||||
@Override |
||||
public HttpHeaders getHeaders() { |
||||
HttpHeaders headers = new HttpHeaders(); |
||||
headers.putAll(super.getHeaders()); |
||||
headers.add("X-InstanceId", instance.getInstanceId()); |
||||
return headers; |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
} |
||||
---- |
||||
|
||||
For `WebClient`, you need to implement and define `LoadBalancerClientRequestTransformer` as follows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Bean |
||||
public LoadBalancerClientRequestTransformer transformer() { |
||||
return new LoadBalancerClientRequestTransformer() { |
||||
@Override |
||||
public ClientRequest transformRequest(ClientRequest request, ServiceInstance instance) { |
||||
return ClientRequest.from(request) |
||||
.header("X-InstanceId", instance.getInstanceId()) |
||||
.build(); |
||||
} |
||||
}; |
||||
} |
||||
---- |
||||
|
||||
If multiple transformers are defined, they are applied in the order in which Beans are defined. |
||||
Alternatively, you can use `LoadBalancerRequestTransformer.DEFAULT_ORDER` or `LoadBalancerClientRequestTransformer.DEFAULT_ORDER` to specify the order. |
||||
|
||||
[[spring-cloud-loadbalancer-starter]] |
||||
== Spring Cloud LoadBalancer Starter |
||||
|
||||
We also provide a starter that allows you to easily add Spring Cloud LoadBalancer in a Spring Boot app. |
||||
In order to use it, just add `org.springframework.cloud:spring-cloud-starter-loadbalancer` to your Spring Cloud dependencies in your build file. |
||||
|
||||
NOTE: Spring Cloud LoadBalancer starter includes |
||||
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-caching.html[Spring Boot Caching] |
||||
and https://github.com/stoyanr/Evictor[Evictor]. |
||||
|
||||
[[custom-loadbalancer-configuration]] |
||||
== Passing Your Own Spring Cloud LoadBalancer Configuration |
||||
|
||||
You can also use the `@LoadBalancerClient` annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, as follows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
@LoadBalancerClient(value = "stores", configuration = CustomLoadBalancerConfiguration.class) |
||||
public class MyConfiguration { |
||||
|
||||
@Bean |
||||
@LoadBalanced |
||||
public WebClient.Builder loadBalancedWebClientBuilder() { |
||||
return WebClient.builder(); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
TIP: In order to make working on your own LoadBalancer configuration easier, we have added a `builder()` method to the `ServiceInstanceListSupplier` class. |
||||
|
||||
TIP: You can also use our alternative predefined configurations in place of the default ones by setting the value of `spring.cloud.loadbalancer.configurations` property to `zone-preference` to use `ZonePreferenceServiceInstanceListSupplier` with caching or to `health-check` to use `HealthCheckServiceInstanceListSupplier` with caching. |
||||
|
||||
|
||||
You can use this feature to instantiate different implementations of `ServiceInstanceListSupplier` or `ReactorLoadBalancer`, either written by you, or provided by us as alternatives (for example `ZonePreferenceServiceInstanceListSupplier`) to override the default setup. |
||||
|
||||
You can see an example of a custom configuration xref:spring-cloud-commons/loadbalancer.adoc#zoned-based-custom-loadbalancer-configuration[here]. |
||||
|
||||
NOTE: The annotation `value` arguments (`stores` in the example above) specifies the service id of the service that we should send the requests to with the given custom configuration. |
||||
|
||||
You can also pass multiple configurations (for more than one load-balancer client) through the `@LoadBalancerClients` annotation, as the following example shows: |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)}) |
||||
public class MyConfiguration { |
||||
|
||||
@Bean |
||||
@LoadBalanced |
||||
public WebClient.Builder loadBalancedWebClientBuilder() { |
||||
return WebClient.builder(); |
||||
} |
||||
} |
||||
---- |
||||
|
||||
NOTE: The classes you pass as `@LoadBalancerClient` or `@LoadBalancerClients` configuration arguments should either not be annotated with `@Configuration` or be outside component scan scope. |
||||
|
||||
NOTE: When you create your own configuration, if you use `CachingServiceInstanceListSupplier` or `HealthCheckServiceInstanceListSupplier`, makes sure to use one of them, not both, and make sure to place it in the hierarchy directly after the supplier that retrieves the instances over the network, for example, `DiscoveryClientServiceInstanceListSupplier`, before any other filtering suppliers. |
||||
|
||||
|
||||
[[loadbalancer-lifecycle]] |
||||
== Spring Cloud LoadBalancer Lifecycle |
||||
|
||||
One type of bean that it may be useful to register using xref:spring-cloud-commons/loadbalancer.adoc#custom-loadbalancer-configuration[Custom LoadBalancer configuration] is `LoadBalancerLifecycle`. |
||||
|
||||
The `LoadBalancerLifecycle` beans provide callback methods, named `onStart(Request<RC> request)`, `onStartRequest(Request<RC> request, Response<T> lbResponse)` and `onComplete(CompletionContext<RES, T, RC> completionContext)`, that you should implement to specify what actions should take place before and after load-balancing. |
||||
|
||||
`onStart(Request<RC> request)` takes a `Request` object as a parameter. It contains data that is used to select an appropriate instance, including the downstream client request and xref:spring-cloud-commons/loadbalancer.adoc#spring-cloud-loadbalancer-hints[hint]. `onStartRequest` also takes the `Request` object and, additionally, the `Response<T>` object as parameters. On the other hand, a `CompletionContext` object is provided to the `onComplete(CompletionContext<RES, T, RC> completionContext)` method. It contains the LoadBalancer `Response`, including the selected service instance, the `Status` of the request executed against that service instance and (if available) the response returned to the downstream client, and (if an exception has occurred) the corresponding `Throwable`. |
||||
|
||||
The `supports(Class requestContextClass, Class responseClass, |
||||
Class serverTypeClass)` method can be used to determine whether the processor in question handles objects of provided types. If not overridden by the user, it returns `true`. |
||||
|
||||
NOTE: In the preceding method calls, `RC` means `RequestContext` type, `RES` means client response type, and `T` means returned server type. |
||||
|
||||
[[loadbalancer-micrometer-stats-lifecycle]] |
||||
== Spring Cloud LoadBalancer Statistics |
||||
|
||||
We provide a `LoadBalancerLifecycle` bean called `MicrometerStatsLoadBalancerLifecycle`, which uses Micrometer to provide statistics for load-balanced calls. |
||||
|
||||
In order to get this bean added to your application context, |
||||
set the value of the `spring.cloud.loadbalancer.stats.micrometer.enabled` to `true` and have a `MeterRegistry` available (for example, by adding https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html[Spring Boot Actuator] to your project). |
||||
|
||||
`MicrometerStatsLoadBalancerLifecycle` registers the following meters in `MeterRegistry`: |
||||
|
||||
* `loadbalancer.requests.active`: A gauge that allows you to monitor the number of currently active requests for any service instance (service instance data available via tags); |
||||
* `loadbalancer.requests.success`: A timer that measures the time of execution of any load-balanced requests that have ended in passing a response on to the underlying client; |
||||
* `loadbalancer.requests.failed`: A timer that measures the time of execution of any load-balanced requests that have ended with an exception; |
||||
* `loadbalancer.requests.discard`: A counter that measures the number of discarded load-balanced requests, i.e. requests where a service instance to run the request on has not been retrieved by the LoadBalancer. |
||||
|
||||
Additional information regarding the service instances, request data, and response data is added to metrics via tags whenever available. |
||||
|
||||
NOTE: For some implementations, such as `BlockingLoadBalancerClient`, request and response data might not be available, as we establish generic types from arguments and might not be able to determine the types and read the data. |
||||
|
||||
NOTE: The meters are registered in the registry when at least one record is added for a given meter. |
||||
|
||||
TIP: You can further configure the behavior of those metrics (for example, add https://micrometer.io/docs/concepts#_histograms_and_percentiles[publishing percentiles and histograms]) by https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-metrics-per-meter-properties[adding `MeterFilters`]. |
||||
|
||||
[[configuring-individual-loadbalancerclients]] |
||||
== Configuring Individual LoadBalancerClients |
||||
|
||||
Individual Loadbalancer clients may be configured individually with a different prefix `spring.cloud.loadbalancer.clients.<clientId>.*` where `clientId` is the name of the loadbalancer. Default configuration values may be set in the `spring.cloud.loadbalancer.*` namespace and will be merged with the client specific values taking precedence |
||||
|
||||
.application.yml |
||||
---- |
||||
spring: |
||||
cloud: |
||||
loadbalancer: |
||||
health-check: |
||||
initial-delay: 1s |
||||
clients: |
||||
myclient: |
||||
health-check: |
||||
interval: 30s |
||||
---- |
||||
|
||||
The above example will result in a merged health-check `@ConfigurationProperties` object with `initial-delay=1s` and `interval=30s`. |
||||
|
||||
The per-client configuration properties work for most of the properties, apart from the following global ones: |
||||
|
||||
- `spring.cloud.loadbalancer.enabled` - globally enables or disables load-balancing |
||||
- `spring.cloud.loadbalancer.retry.enabled` - globally enables or disables load-balanced retries. If you enable it globally, you can still disable retries for specific clients using the `client`-prefixed properties, but not the other way round |
||||
- `spring.cloud.loadbalancer.cache.enabled` - globally enables or disables LoadBalancer caching. If you enable it globally, you can still disable caching for specific clients by creating a xref:spring-cloud-commons/loadbalancer.adoc#custom-loadbalancer-configuration[custom configuration] that does not include the `CachingServiceInstanceListSupplier` in the `ServiceInstanceListSupplier` delegates hierarchy, but not the other way round. |
||||
- `spring.cloud.loadbalancer.stats.micrometer.enabled` - globally enables or disables LoadBalancer Micrometer metrics |
||||
|
||||
NOTE: For the properties where maps where already used, where you can specify a different value per-client without using the `clients` keyword (for example, `hints`, `health-check.path`), we have kept that behaviour in order to keep the library backwards compatible. It will be modified in the next major release. |
||||
|
||||
NOTE: Starting with `4.1.0`, we have introduced the `callGetWithRequestOnDelegates` flag in `LoadBalancerProperties`. If this flag is set to `true`, `ServiceInstanceListSupplier#get(Request request)` method will be implemented to call `delegate.get(request)` in classes assignable from `DelegatingServiceInstanceListSupplier` that don't already implement that method, with the exclusion of `CachingServiceInstanceListSupplier` and `HealthCheckServiceInstanceListSupplier`, which should be placed in the instance supplier hierarchy directly after the supplier performing instance retrieval over the network, before any request-based filtering is done. It is set to `true` by default. |
||||
|
||||
[[-aot-and-native-image-support]] |
||||
== AOT and Native Image Support |
||||
|
||||
Since `4.0.0`, Spring Cloud LoadBalancer supports Spring AOT transformations and native images. However, to use this feature, you need to explicitly define your `LoadBalancerClient` service IDs. You can do so by using the `value` or `name` attributes of the `@LoadBalancerClient` annotation or as values of the `spring.cloud.loadbalancer.eager-load.clients` property. |
||||
|
@ -1,89 +0,0 @@
@@ -1,89 +0,0 @@
|
||||
[[spring-cloud-security]] |
||||
= Security |
||||
|
||||
[[spring-cloud-security-single-sign-on]] |
||||
== Single Sign On |
||||
|
||||
NOTE: All of the OAuth2 SSO and resource server features moved to Spring Boot |
||||
in version 1.3. You can find documentation in the |
||||
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/[Spring Boot user guide]. |
||||
|
||||
[[spring-cloud-security-client-token-relay]] |
||||
=== Client Token Relay |
||||
|
||||
If your app is a user facing OAuth2 client (i.e. has declared |
||||
`@EnableOAuth2Sso` or `@EnableOAuth2Client`) then it has an |
||||
`OAuth2ClientContext` in request scope from Spring Boot. You can |
||||
create your own `OAuth2RestTemplate` from this context and an |
||||
autowired `OAuth2ProtectedResourceDetails`, and then the context will |
||||
always forward the access token downstream, also refreshing the access |
||||
token automatically if it expires. (These are features of Spring |
||||
Security and Spring Boot.) |
||||
|
||||
[[spring-cloud-security-resource-server-token-relay]] |
||||
=== Resource Server Token Relay |
||||
|
||||
If your app has `@EnableResourceServer` you might want to relay the |
||||
incoming token downstream to other services. If you use a |
||||
`RestTemplate` to contact the downstream services then this is just a |
||||
matter of how to create the template with the right context. |
||||
|
||||
If your service uses `UserInfoTokenServices` to authenticate incoming |
||||
tokens (i.e. it is using the `security.oauth2.user-info-uri` |
||||
configuration), then you can simply create an `OAuth2RestTemplate` |
||||
using an autowired `OAuth2ClientContext` (it will be populated by the |
||||
authentication process before it hits the backend code). Equivalently |
||||
(with Spring Boot 1.4), you can inject a |
||||
`UserInfoRestTemplateFactory` and grab its `OAuth2RestTemplate` in |
||||
your configuration. For example: |
||||
|
||||
.MyConfiguration.java |
||||
[source,java] |
||||
---- |
||||
@Bean |
||||
public OAuth2RestTemplate restTemplate(UserInfoRestTemplateFactory factory) { |
||||
return factory.getUserInfoRestTemplate(); |
||||
} |
||||
---- |
||||
|
||||
This rest template will then have the same `OAuth2ClientContext` |
||||
(request-scoped) that is used by the authentication filter, so you can |
||||
use it to send requests with the same access token. |
||||
|
||||
If your app is not using `UserInfoTokenServices` but is still a client |
||||
(i.e. it declares `@EnableOAuth2Client` or `@EnableOAuth2Sso`), then |
||||
with Spring Security Cloud any `OAuth2RestOperations` that the user |
||||
creates from an `@Autowired` `OAuth2Context` will also forward |
||||
tokens. This feature is implemented by default as an MVC handler |
||||
interceptor, so it only works in Spring MVC. If you are not using MVC |
||||
you can use a custom filter or AOP interceptor wrapping an |
||||
`AccessTokenContextRelay` to provide the same feature. |
||||
|
||||
Here's a basic |
||||
example showing the use of an autowired rest template created |
||||
elsewhere ("foo.com" is a Resource Server accepting the same tokens as |
||||
the surrounding app): |
||||
|
||||
.MyController.java |
||||
[source,java] |
||||
---- |
||||
@Autowired |
||||
private OAuth2RestOperations restTemplate; |
||||
|
||||
@RequestMapping("/relay") |
||||
public String relay() { |
||||
ResponseEntity<String> response = |
||||
restTemplate.getForEntity("https://foo.com/bar", String.class); |
||||
return "Success! (" + response.getBody() + ")"; |
||||
} |
||||
---- |
||||
|
||||
If you don't want to forward tokens (and that is a valid |
||||
choice, since you might want to act as yourself, rather than the |
||||
client that sent you the token), then you only need to create your own |
||||
`OAuth2Context` instead of autowiring the default one. |
||||
|
||||
Feign clients will also pick up an interceptor that uses the |
||||
`OAuth2ClientContext` if it is available, so they should also do a |
||||
token relay anywhere where a `RestTemplate` would. |
||||
|
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
:sc-ext: java |
||||
:project-full-name: Spring Cloud Commons |
||||
:all: {asterisk}{asterisk} |
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
|=== |
||||
|Name | Default | Description |
||||
|
||||
|spring.cloud.compatibility-verifier.compatible-boot-versions | `+++3.2.x+++` | Default accepted versions for the Spring Boot dependency. You can set {@code x} for the patch version if you don't want to specify a concrete value. Example: {@code 3.4.x} |
||||
|spring.cloud.compatibility-verifier.enabled | `+++false+++` | Enables creation of Spring Cloud compatibility verification. |
||||
|spring.cloud.config.allow-override | `+++true+++` | Flag to indicate that {@link #isOverrideSystemProperties() systemPropertiesOverride} can be used. Set to false to prevent users from changing the default accidentally. Default true. |
||||
|spring.cloud.config.initialize-on-context-refresh | `+++false+++` | Flag to initialize bootstrap configuration on context refresh event. Default false. |
||||
|spring.cloud.config.override-none | `+++false+++` | Flag to indicate that when {@link #setAllowOverride(boolean) allowOverride} is true, external properties should take lowest priority and should not override any existing property sources (including local config files). Default false. This will only have an effect when using config first bootstrap. |
||||
|spring.cloud.config.override-system-properties | `+++true+++` | Flag to indicate that the external properties should override system properties. Default true. |
||||
|spring.cloud.decrypt-environment-post-processor.enabled | `+++true+++` | Enable the DecryptEnvironmentPostProcessor. |
||||
|spring.cloud.discovery.client.composite-indicator.enabled | `+++true+++` | Enables discovery client composite health indicator. |
||||
|spring.cloud.discovery.client.health-indicator.enabled | `+++true+++` | |
||||
|spring.cloud.discovery.client.health-indicator.include-description | `+++false+++` | |
||||
|spring.cloud.discovery.client.health-indicator.use-services-query | `+++true+++` | Whether or not the indicator should use {@link DiscoveryClient#getServices} to check its health. When set to {@code false} the indicator instead uses the lighter {@link DiscoveryClient#probe()}. This can be helpful in large deployments where the number of services returned makes the operation unnecessarily heavy. |
||||
|spring.cloud.discovery.client.simple.instances | | |
||||
|spring.cloud.discovery.client.simple.local.host | | |
||||
|spring.cloud.discovery.client.simple.local.instance-id | | |
||||
|spring.cloud.discovery.client.simple.local.metadata | | |
||||
|spring.cloud.discovery.client.simple.local.port | `+++0+++` | |
||||
|spring.cloud.discovery.client.simple.local.secure | `+++false+++` | |
||||
|spring.cloud.discovery.client.simple.local.service-id | | |
||||
|spring.cloud.discovery.client.simple.local.uri | | |
||||
|spring.cloud.discovery.client.simple.order | | |
||||
|spring.cloud.discovery.enabled | `+++true+++` | Enables discovery client health indicators. |
||||
|spring.cloud.features.enabled | `+++true+++` | Enables the features endpoint. |
||||
|spring.cloud.httpclientfactories.apache.enabled | `+++true+++` | Enables creation of Apache Http Client factory beans. |
||||
|spring.cloud.httpclientfactories.ok.enabled | `+++true+++` | Enables creation of OK Http Client factory beans. |
||||
|spring.cloud.hypermedia.refresh.fixed-delay | `+++5000+++` | |
||||
|spring.cloud.hypermedia.refresh.initial-delay | `+++10000+++` | |
||||
|spring.cloud.inetutils.default-hostname | `+++localhost+++` | The default hostname. Used in case of errors. |
||||
|spring.cloud.inetutils.default-ip-address | `+++127.0.0.1+++` | The default IP address. Used in case of errors. |
||||
|spring.cloud.inetutils.ignored-interfaces | | List of Java regular expressions for network interfaces that will be ignored. |
||||
|spring.cloud.inetutils.preferred-networks | | List of Java regular expressions for network addresses that will be preferred. |
||||
|spring.cloud.inetutils.timeout-seconds | `+++1+++` | Timeout, in seconds, for calculating hostname. |
||||
|spring.cloud.inetutils.use-only-site-local-interfaces | `+++false+++` | Whether to use only interfaces with site local addresses. See {@link InetAddress#isSiteLocalAddress()} for more details. |
||||
|spring.cloud.loadbalancer.cache.caffeine.spec | | The spec to use to create caches. See CaffeineSpec for more details on the spec format. |
||||
|spring.cloud.loadbalancer.cache.capacity | `+++256+++` | Initial cache capacity expressed as int. |
||||
|spring.cloud.loadbalancer.cache.enabled | `+++true+++` | Enables Spring Cloud LoadBalancer caching mechanism. |
||||
|spring.cloud.loadbalancer.cache.ttl | `+++35s+++` | Time To Live - time counted from writing of the record, after which cache entries are expired, expressed as a {@link Duration}. The property {@link String} has to be in keeping with the appropriate syntax as specified in Spring Boot <code>StringToDurationConverter</code>. @see <a href= "https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToDurationConverter.java">StringToDurationConverter.java</a> |
||||
|spring.cloud.loadbalancer.call-get-with-request-on-delegates | `+++true+++` | If this flag is set to {@code true}, {@code ServiceInstanceListSupplier#get(Request request)} method will be implemented to call {@code delegate.get(request)} in classes assignable from {@code DelegatingServiceInstanceListSupplier} that don't already implement that method, with the exclusion of {@code CachingServiceInstanceListSupplier} and {@code HealthCheckServiceInstanceListSupplier}, which should be placed in the instance supplier hierarchy directly after the supplier performing instance retrieval over the network, before any request-based filtering is done, {@code true} by default. |
||||
|spring.cloud.loadbalancer.clients | | |
||||
|spring.cloud.loadbalancer.configurations | `+++default+++` | Enables a predefined LoadBalancer configuration. |
||||
|spring.cloud.loadbalancer.eager-load.clients | | Names of the clients. |
||||
|spring.cloud.loadbalancer.enabled | `+++true+++` | Enables Spring Cloud LoadBalancer. |
||||
|spring.cloud.loadbalancer.health-check.initial-delay | `+++0+++` | Initial delay value for the HealthCheck scheduler. |
||||
|spring.cloud.loadbalancer.health-check.interval | `+++25s+++` | Interval for rerunning the HealthCheck scheduler. |
||||
|spring.cloud.loadbalancer.health-check.interval | `+++25s+++` | Interval for rerunning the HealthCheck scheduler. |
||||
|spring.cloud.loadbalancer.health-check.path | | Path at which the health-check request should be made. Can be set up per `serviceId`. A `default` value can be set up as well. If none is set up, `/actuator/health` will be used. |
||||
|spring.cloud.loadbalancer.health-check.port | | Path at which the health-check request should be made. If none is set, the port under which the requested service is available at the service instance. |
||||
|spring.cloud.loadbalancer.health-check.refetch-instances | `+++false+++` | Indicates whether the instances should be refetched by the `HealthCheckServiceInstanceListSupplier`. This can be used if the instances can be updated and the underlying delegate does not provide an ongoing flux. |
||||
|spring.cloud.loadbalancer.health-check.refetch-instances-interval | `+++25s+++` | Interval for refetching available service instances. |
||||
|spring.cloud.loadbalancer.health-check.repeat-health-check | `+++true+++` | Indicates whether health checks should keep repeating. It might be useful to set it to `false` if periodically refetching the instances, as every refetch will also trigger a healthcheck. |
||||
|spring.cloud.loadbalancer.health-check.update-results-list | `+++true+++` | Indicates whether the {@code healthCheckFlux} should emit on each alive {@link ServiceInstance} that has been retrieved. If set to {@code false}, the entire alive instances sequence is first collected into a list and only then emitted. |
||||
|spring.cloud.loadbalancer.hint | | Allows setting the value of <code>hint</code> that is passed on to the LoadBalancer request and can subsequently be used in {@link ReactiveLoadBalancer} implementations. |
||||
|spring.cloud.loadbalancer.hint-header-name | `+++X-SC-LB-Hint+++` | Allows setting the name of the header used for passing the hint for hint-based service instance filtering. |
||||
|spring.cloud.loadbalancer.retry.avoid-previous-instance | `+++true+++` | Enables wrapping ServiceInstanceListSupplier beans with `RetryAwareServiceInstanceListSupplier` if Spring-Retry is in the classpath. |
||||
|spring.cloud.loadbalancer.retry.backoff.enabled | `+++false+++` | Indicates whether Reactor Retry backoffs should be applied. |
||||
|spring.cloud.loadbalancer.retry.backoff.jitter | `+++0.5+++` | Used to set `RetryBackoffSpec.jitter`. |
||||
|spring.cloud.loadbalancer.retry.backoff.max-backoff | `+++Long.MAX ms+++` | Used to set `RetryBackoffSpec.maxBackoff`. |
||||
|spring.cloud.loadbalancer.retry.backoff.min-backoff | `+++5 ms+++` | Used to set `RetryBackoffSpec#minBackoff`. |
||||
|spring.cloud.loadbalancer.retry.enabled | `+++true+++` | Enables LoadBalancer retries. |
||||
|spring.cloud.loadbalancer.retry.max-retries-on-next-service-instance | `+++1+++` | Number of retries to be executed on the next `ServiceInstance`. A `ServiceInstance` is chosen before each retry call. |
||||
|spring.cloud.loadbalancer.retry.max-retries-on-same-service-instance | `+++0+++` | Number of retries to be executed on the same `ServiceInstance`. |
||||
|spring.cloud.loadbalancer.retry.retry-on-all-exceptions | `+++false+++` | Indicates retries should be attempted for all exceptions, not only those specified in `retryableExceptions`. |
||||
|spring.cloud.loadbalancer.retry.retry-on-all-operations | `+++false+++` | Indicates retries should be attempted on operations other than `HttpMethod.GET`. |
||||
|spring.cloud.loadbalancer.retry.retryable-exceptions | `+++{}+++` | A `Set` of `Throwable` classes that should trigger a retry. |
||||
|spring.cloud.loadbalancer.retry.retryable-status-codes | `+++{}+++` | A `Set` of status codes that should trigger a retry. |
||||
|spring.cloud.loadbalancer.service-discovery.timeout | | String representation of Duration of the timeout for calls to service discovery. |
||||
|spring.cloud.loadbalancer.stats.micrometer.enabled | `+++false+++` | Enables Spring Cloud LoadBalancer Micrometer stats. |
||||
|spring.cloud.loadbalancer.sticky-session.add-service-instance-cookie | `+++false+++` | Indicates whether a cookie with the newly selected instance should be added by LoadBalancer. |
||||
|spring.cloud.loadbalancer.sticky-session.instance-id-cookie-name | `+++sc-lb-instance-id+++` | The name of the cookie holding the preferred instance id. |
||||
|spring.cloud.loadbalancer.x-forwarded.enabled | `+++false+++` | To Enable X-Forwarded Headers. |
||||
|spring.cloud.loadbalancer.zone | | Spring Cloud LoadBalancer zone. |
||||
|spring.cloud.refresh.additional-property-sources-to-retain | | Additional property sources to retain during a refresh. Typically only system property sources are retained. This property allows property sources, such as property sources created by EnvironmentPostProcessors to be retained as well. |
||||
|spring.cloud.refresh.enabled | `+++true+++` | Enables autoconfiguration for the refresh scope and associated features. |
||||
|spring.cloud.refresh.extra-refreshable | `+++true+++` | Additional class names for beans to post process into refresh scope. |
||||
|spring.cloud.refresh.never-refreshable | `+++true+++` | Comma separated list of class names for beans to never be refreshed or rebound. |
||||
|spring.cloud.refresh.on-restart.enabled | `+++true+++` | Enable refreshing context on start. |
||||
|spring.cloud.service-registry.auto-registration.enabled | `+++true+++` | Whether service auto-registration is enabled. Defaults to true. |
||||
|spring.cloud.service-registry.auto-registration.fail-fast | `+++false+++` | Whether startup fails if there is no AutoServiceRegistration. Defaults to false. |
||||
|spring.cloud.service-registry.auto-registration.register-management | `+++true+++` | Whether to register the management as a service. Defaults to true. |
||||
|spring.cloud.util.enabled | `+++true+++` | Enables creation of Spring Cloud utility beans. |
||||
|
||||
|=== |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
[[observability-conventions]] |
||||
=== Observability - Conventions |
||||
|
||||
Below you can find a list of all `GlobalObservationConvention` and `ObservationConvention` declared by this project. |
||||
|
||||
.ObservationConvention implementations |
||||
|=== |
||||
|ObservationConvention Class Name | Applicable ObservationContext Class Name |
||||
|`org.springframework.cloud.client.circuitbreaker.observation.CircuitBreakerObservationConvention`|`CircuitBreakerObservationContext` |
||||
|`org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`|`CircuitBreakerObservationContext` |
||||
|=== |
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
[[observability-metrics]] |
||||
=== Observability - Metrics |
||||
|
||||
Below you can find a list of all metrics declared by this project. |
||||
|
||||
[[observability-metrics-circuit-breaker-function-observation]] |
||||
==== Circuit Breaker Function Observation |
||||
|
||||
____ |
||||
Observation created when we wrap a Function passed to the CircuitBreaker as fallback. |
||||
____ |
||||
|
||||
|
||||
**Metric name** `spring.cloud.circuitbreaker` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). **Type** `timer`. |
||||
|
||||
**Metric name** `spring.cloud.circuitbreaker.active` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). **Type** `long task timer`. |
||||
|
||||
|
||||
IMPORTANT: KeyValues that are added after starting the Observation might be missing from the *.active metrics. |
||||
|
||||
|
||||
IMPORTANT: Micrometer internally uses `nanoseconds` for the baseunit. However, each backend determines the actual baseunit. (i.e. Prometheus uses seconds) |
||||
|
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.cloud.client.circuitbreaker.observation.CircuitBreakerObservationDocumentation`. |
||||
|
||||
IMPORTANT: All tags must be prefixed with `spring.cloud.circuitbreaker` prefix! |
||||
|
||||
.Low cardinality Keys |
||||
[cols="a,a"] |
||||
|=== |
||||
|Name | Description |
||||
|`spring.cloud.circuitbreaker.type` _(required)_|Defines the type of wrapped lambda. |
||||
|=== |
||||
|
||||
|
||||
|
||||
[[observability-metrics-circuit-breaker-supplier-observation]] |
||||
==== Circuit Breaker Supplier Observation |
||||
|
||||
____ |
||||
Observation created when we wrap a Supplier passed to the CircuitBreaker. |
||||
____ |
||||
|
||||
|
||||
**Metric name** `spring.cloud.circuitbreaker` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). **Type** `timer`. |
||||
|
||||
**Metric name** `spring.cloud.circuitbreaker.active` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). **Type** `long task timer`. |
||||
|
||||
|
||||
IMPORTANT: KeyValues that are added after starting the Observation might be missing from the *.active metrics. |
||||
|
||||
|
||||
IMPORTANT: Micrometer internally uses `nanoseconds` for the baseunit. However, each backend determines the actual baseunit. (i.e. Prometheus uses seconds) |
||||
|
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.cloud.client.circuitbreaker.observation.CircuitBreakerObservationDocumentation`. |
||||
|
||||
IMPORTANT: All tags must be prefixed with `spring.cloud.circuitbreaker` prefix! |
||||
|
||||
.Low cardinality Keys |
||||
[cols="a,a"] |
||||
|=== |
||||
|Name | Description |
||||
|`spring.cloud.circuitbreaker.type` _(required)_|Defines the type of wrapped lambda. |
||||
|=== |
||||
|
||||
|
||||
|
||||
|
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
[[observability-spans]] |
||||
=== Observability - Spans |
||||
|
||||
Below you can find a list of all spans declared by this project. |
||||
|
||||
[[observability-spans-circuit-breaker-function-observation]] |
||||
==== Circuit Breaker Function Observation Span |
||||
|
||||
> Observation created when we wrap a Function passed to the CircuitBreaker as fallback. |
||||
|
||||
**Span name** `spring.cloud.circuitbreaker` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). |
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.cloud.client.circuitbreaker.observation.CircuitBreakerObservationDocumentation`. |
||||
|
||||
IMPORTANT: All tags must be prefixed with `spring.cloud.circuitbreaker` prefix! |
||||
|
||||
.Tag Keys |
||||
|=== |
||||
|Name | Description |
||||
|`spring.cloud.circuitbreaker.type` _(required)_|Defines the type of wrapped lambda. |
||||
|=== |
||||
|
||||
|
||||
|
||||
[[observability-spans-circuit-breaker-supplier-observation]] |
||||
==== Circuit Breaker Supplier Observation Span |
||||
|
||||
> Observation created when we wrap a Supplier passed to the CircuitBreaker. |
||||
|
||||
**Span name** `spring.cloud.circuitbreaker` (defined by convention class `org.springframework.cloud.client.circuitbreaker.observation.DefaultCircuitBreakerObservationConvention`). |
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.cloud.client.circuitbreaker.observation.CircuitBreakerObservationDocumentation`. |
||||
|
||||
IMPORTANT: All tags must be prefixed with `spring.cloud.circuitbreaker` prefix! |
||||
|
||||
.Tag Keys |
||||
|=== |
||||
|Name | Description |
||||
|`spring.cloud.circuitbreaker.type` _(required)_|Defines the type of wrapped lambda. |
||||
|=== |
||||
|
||||
|
||||
|
||||
|
@ -1,110 +1,57 @@
@@ -1,110 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-commons-docs</artifactId> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
<parent> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-commons-parent</artifactId> |
||||
<version>4.1.0-SNAPSHOT</version> |
||||
<artifactId>spring-cloud-build</artifactId> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
<relativePath/> |
||||
</parent> |
||||
<packaging>jar</packaging> |
||||
<packaging>pom</packaging> |
||||
<name>Spring Cloud Commons Docs</name> |
||||
<description>Spring Cloud Commons Docs</description> |
||||
<properties> |
||||
<docs.main>spring-cloud-commons</docs.main> |
||||
<docs.main>spring-cloud-commons</docs.main> |
||||
<main.basedir>${basedir}/..</main.basedir> |
||||
<configprops.inclusionPattern>spring.cloud.*</configprops.inclusionPattern> |
||||
<!-- Don't upload docs jar to central / repo.spring.io --> |
||||
<maven-deploy-plugin-default.phase>none</maven-deploy-plugin-default.phase> |
||||
|
||||
<!-- Observability --> |
||||
<micrometer-docs-generator.version>1.0.2</micrometer-docs-generator.version> |
||||
<micrometer-docs-generator.inputPath>${maven.multiModuleProjectDirectory}/spring-cloud-commons/</micrometer-docs-generator.inputPath> |
||||
<micrometer-docs-generator.inclusionPattern>.*</micrometer-docs-generator.inclusionPattern> |
||||
<micrometer-docs-generator.outputPath>${maven.multiModuleProjectDirectory}/docs/modules/ROOT/partials/</micrometer-docs-generator.outputPath> |
||||
<docs.whitelisted.branches>1.0.x</docs.whitelisted.branches> |
||||
</properties> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>${project.groupId}</groupId> |
||||
<artifactId>spring-cloud-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>${project.groupId}</groupId> |
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<sourceDirectory>src/main/asciidoc</sourceDirectory> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<!--skip deploy (this is just a test module) --> |
||||
<artifactId>maven-deploy-plugin</artifactId> |
||||
<configuration> |
||||
<skip>true</skip> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
<profiles> |
||||
<profiles> |
||||
<profile> |
||||
<id>docs</id> |
||||
<build> |
||||
<resources> |
||||
<resource> |
||||
<directory>src/main/antora/resources/antora-resources</directory> |
||||
<filtering>true</filtering> |
||||
</resource> |
||||
</resources> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>pl.project13.maven</groupId> |
||||
<artifactId>git-commit-id-plugin</artifactId> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-dependency-plugin</artifactId> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.codehaus.mojo</groupId> |
||||
<artifactId>exec-maven-plugin</artifactId> |
||||
<executions> |
||||
<execution> |
||||
<id>generate-observability-docs</id> |
||||
<phase>${generate-docs.phase}</phase> |
||||
<goals> |
||||
<goal>java</goal> |
||||
</goals> |
||||
<configuration> |
||||
<mainClass>io.micrometer.docs.DocsGeneratorCommand</mainClass> |
||||
<includePluginDependencies>true</includePluginDependencies> |
||||
<arguments> |
||||
<argument>${micrometer-docs-generator.inputPath}</argument> |
||||
<argument>${micrometer-docs-generator.inclusionPattern}</argument> |
||||
<argument>${micrometer-docs-generator.outputPath}</argument> |
||||
</arguments> |
||||
</configuration> |
||||
</execution> |
||||
</executions> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>io.micrometer</groupId> |
||||
<artifactId>micrometer-docs-generator</artifactId> |
||||
<version>${micrometer-docs-generator.version}</version> |
||||
<type>jar</type> |
||||
</dependency> |
||||
</dependencies> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>io.spring.maven.antora</groupId> |
||||
<artifactId>antora-component-version-maven-plugin</artifactId> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>io.spring.maven.antora</groupId> |
||||
<artifactId>antora-maven-plugin</artifactId> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
</plugin> |
||||
<plugin> |
||||
<artifactId>maven-deploy-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.asciidoctor</groupId> |
||||
<artifactId>asciidoctor-maven-plugin</artifactId> |
||||
<version>1.5.0</version> |
||||
<inherited>false</inherited> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
<inherited>false</inherited> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.codehaus.mojo</groupId> |
||||
<artifactId>build-helper-maven-plugin</artifactId> |
||||
<inherited>false</inherited> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</profile> |
||||
</profiles> |
||||
</profiles> |
||||
</project> |
||||
|
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
version: @antora-component.version@ |
||||
prerelease: @antora-component.prerelease@ |
||||
|
||||
asciidoc: |
||||
attributes: |
||||
attribute-missing: 'warn' |
||||
chomp: 'all' |
||||
project-root: @maven.multiModuleProjectDirectory@ |
||||
github-repo: @docs.main@ |
||||
github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ |
||||
github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@ |
||||
github-issues: https://github.com/spring-cloud/@docs.main@/issues/ |
||||
github-wiki: https://github.com/spring-cloud/@docs.main@/wiki |
||||
spring-cloud-version: @project.version@ |
||||
github-tag: @github-tag@ |
||||
version-type: @version-type@ |
||||
docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@ |
||||
raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ |
||||
project-version: @project.version@ |
||||
project-name: @docs.main@ |
@ -1,12 +1,11 @@
@@ -1,12 +1,11 @@
|
||||
image::https://travis-ci.org/spring-cloud/spring-cloud-commons.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-commons] |
||||
|
||||
[[building]] |
||||
= Building |
||||
:page-section-summary-toc: 1 |
||||
include::intro.adoc[] |
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building.adoc[] |
||||
== Building |
||||
|
||||
[[contributing]] |
||||
= Contributing |
||||
:page-section-summary-toc: 1 |
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[] |
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.adoc[] |
||||
== Contributing |
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] |
||||
|
@ -0,0 +1,123 @@
@@ -0,0 +1,123 @@
|
||||
#!/bin/bash -x |
||||
|
||||
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 ]; then |
||||
echo "No gh-pages sources in docs/target/generated-docs, so not syncing" |
||||
exit 0 |
||||
fi |
||||
|
||||
# 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 |
||||
|
||||
# Retrieve properties |
||||
################################################################### |
||||
|
||||
# Prop that will let commit the changes |
||||
COMMIT_CHANGES="no" |
||||
|
||||
# Get the name of the `docs.main` property |
||||
MAIN_ADOC_VALUE=$(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}]" |
||||
|
||||
# Get whitelisted branches - assumes that a `docs` module is available under `docs` profile |
||||
WHITELIST_PROPERTY="docs.whitelisted.branches" |
||||
WHITELISTED_BRANCHES_VALUE=$(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}]" |
||||
|
||||
# Code getting the name of the current branch. For master we want to publish as we did until now |
||||
# https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch |
||||
CURRENT_BRANCH=$(git symbolic-ref -q HEAD) |
||||
CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/} |
||||
CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD} |
||||
echo "Current branch is [${CURRENT_BRANCH}]" |
||||
|
||||
# Stash any outstanding changes |
||||
################################################################### |
||||
git diff-index --quiet HEAD |
||||
dirty=$? |
||||
if [ "$dirty" != "0" ]; then git stash; fi |
||||
|
||||
# Switch to gh-pages branch to sync it with master |
||||
################################################################### |
||||
git checkout gh-pages |
||||
git pull origin gh-pages |
||||
|
||||
# Add git branches |
||||
################################################################### |
||||
mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH} |
||||
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}]" |
||||
# https://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 |
||||
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 |
||||
|
||||
if [[ "${COMMIT_CHANGES}" == "yes" ]] ; then |
||||
git commit -a -m "Sync docs from ${CURRENT_BRANCH} to gh-pages" |
||||
|
||||
# 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! |
||||
################################################################### |
||||
git push origin gh-pages |
||||
fi |
||||
|
||||
# Finally, switch back to the master branch and exit block |
||||
git checkout ${CURRENT_BRANCH} |
||||
if [ "$dirty" != "0" ]; then git stash pop; fi |
||||
|
||||
exit 0 |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
|
||||
https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook[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 https://12factor.net/[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 https://projects.spring.io/spring-boot[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). |
||||
|
||||
include::jce.adoc[] |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
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 Link https://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html |
||||
* Java 7 JCE Link https://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html |
||||
* Java 8 JCE Link https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html |
||||
|
||||
Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using). |
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
Spring Cloud Commons delivers features 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). |
||||
|
||||
## Features |
||||
|
||||
### Spring Cloud Context features: |
||||
|
||||
* Bootstrap Context |
||||
* `TextEncryptor` beans |
||||
* Refresh Scope |
||||
* Spring Boot Actuator endpoints for manipulating the `Environment` |
||||
|
||||
### Spring Cloud Commons features: |
||||
|
||||
* `DiscoveryClient` interface |
||||
* `ServiceRegistry` interface |
||||
* Instrumentation for `RestTemplate` to resolve hostnames using `DiscoveryClient` |
@ -0,0 +1,351 @@
@@ -0,0 +1,351 @@
|
||||
= Cloud Native Applications |
||||
:githubroot: https://github.com/spring-cloud |
||||
:github: https://github.com/spring-cloud/spring-cloud-commons |
||||
:githubmaster: {github}/tree/master |
||||
:docslink: {githubmaster}/docs/src/main/asciidoc |
||||
:toc: |
||||
|
||||
include::intro.adoc[] |
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[] |
||||
|
||||
== 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. |
||||
|
||||
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 |
||||
link:#customizing-bootstrap-property-sources[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 link:#customizing-bootstrap-properties[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. |
||||
|
||||
[[customizing-bootstrap-properties]] |
||||
=== 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. |
||||
|
||||
=== 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-bootstrap-property-sources]] |
||||
=== 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: |
||||
|
||||
[source,java] |
||||
---- |
||||
@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 `EnvironmentChangedEvent` 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 `EnvironmentChangedEvent` 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 `EnvironmentChangedEvent` to all |
||||
the instances instead of having them polling for changes (e.g. using |
||||
the https://github.com/spring-cloud/spring-cloud-bus[Spring Cloud |
||||
Bus]). |
||||
|
||||
The `EnvironmentChangedEvent` 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 |
||||
|
||||
The Config Client 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 a client 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. |
||||
|
||||
include::jce.adoc |
||||
|
||||
=== 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). |
||||
|
||||
|
||||
=== Spring RestTemplate as a Load Balancer Client |
||||
|
||||
You can use Ribbon indirectly via an autoconfigured `RestTemplate` |
||||
when RestTemplate is on the classpath and a `LoadBalancerClient` bean is defined): |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
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 |
||||
{githubroot}/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonAutoConfiguration.java[RibbonAutoConfiguration] |
||||
for details of how the `RestTemplate` is set up. |
||||
|
||||
=== 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 provided `@LoadBalanced` `Qualifier`. |
||||
|
||||
IMPORTANT: Notice the `@Primary` annotation on the plain `RestTemplate` declaration. |
||||
|
||||
[source,java,indent=0] |
||||
---- |
||||
@Configuration |
||||
public class MyConfiguration { |
||||
|
||||
@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("https://example.com", String.class); |
||||
} |
||||
} |
||||
---- |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env ruby |
||||
|
||||
base_dir = File.join(File.dirname(__FILE__),'../../..') |
||||
src_dir = File.join(base_dir, "/src/main/asciidoc") |
||||
require 'asciidoctor' |
||||
require 'optparse' |
||||
|
||||
options = {} |
||||
file = "#{src_dir}/README.adoc" |
||||
|
||||
OptionParser.new do |o| |
||||
o.on('-o OUTPUT_FILE', 'Output file (default is stdout)') { |file| options[:to_file] = file unless file=='-' } |
||||
o.on('-h', '--help') { puts o; exit } |
||||
o.parse! |
||||
end |
||||
|
||||
file = ARGV[0] if ARGV.length>0 |
||||
|
||||
srcDir = File.dirname(file) |
||||
out = "// Do not edit this file (e.g. go instead to docs/src/main/asciidoc)\n\n" |
||||
doc = Asciidoctor.load_file file, safe: :safe, parse: false, attributes: 'allow-uri-read' |
||||
out << doc.reader.read |
||||
|
||||
unless options[:to_file] |
||||
puts out |
||||
else |
||||
File.open(options[:to_file],'w+') do |file| |
||||
file.write(out) |
||||
end |
||||
end |
@ -1,804 +0,0 @@
@@ -1,804 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<profiles version="13"> |
||||
<profile kind="CodeFormatterProfile" name="Spring Cloud Java Conventions" |
||||
version="12"> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" |
||||
value="common_lines"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" |
||||
value="common_lines"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" |
||||
value="@formatter:off"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" |
||||
value="0"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" |
||||
value="1"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" |
||||
value="1"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" |
||||
value="end_of_line"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="90"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" |
||||
value="end_of_line"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" |
||||
value="16"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" |
||||
value="16"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" |
||||
value="end_of_line"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" |
||||
value="16"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" |
||||
value="16"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" |
||||
value="error"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" |
||||
value="1"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" |
||||
value="common_lines"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" |
||||
value="16"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" |
||||
value="0"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" |
||||
value="end_of_line"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" |
||||
value="enabled"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" |
||||
value="0"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" |
||||
value="2147483647"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" |
||||
value="80"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" |
||||
value="false"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.source" value="9"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" |
||||
value="2"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="9"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" |
||||
value="end_of_line"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" |
||||
value="common_lines"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" |
||||
value="1"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" |
||||
value="1"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" |
||||
value="false"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" |
||||
value="16"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.compiler.compliance" value="9"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" |
||||
value="common_lines"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" |
||||
value="end_of_line"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" |
||||
value="0"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" |
||||
value="true"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" |
||||
value="insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" |
||||
value="true"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" |
||||
value="insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" |
||||
value="do not insert"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" |
||||
value="1"/> |
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="90"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" |
||||
value="do not insert"/> |
||||
<setting |
||||
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" |
||||
value="insert"/> |
||||
</profile> |
||||
</profiles> |
@ -1,412 +0,0 @@
@@ -1,412 +0,0 @@
|
||||
eclipse.preferences.version=1 |
||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes= |
||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes= |
||||
org.eclipse.jdt.core.codeComplete.fieldPrefixes= |
||||
org.eclipse.jdt.core.codeComplete.fieldSuffixes= |
||||
org.eclipse.jdt.core.codeComplete.localPrefixes= |
||||
org.eclipse.jdt.core.codeComplete.localSuffixes= |
||||
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= |
||||
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= |
||||
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= |
||||
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= |
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate |
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 |
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
||||
org.eclipse.jdt.core.compiler.compliance=1.8 |
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate |
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate |
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate |
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled |
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning |
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore |
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning |
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning |
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning |
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled |
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled |
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning |
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore |
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore |
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled |
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore |
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning |
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning |
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning |
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning |
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled |
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning |
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore |
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore |
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning |
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled |
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled |
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled |
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default |
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore |
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning |
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore |
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled |
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=default |
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore |
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled |
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore |
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore |
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning |
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning |
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore |
||||
org.eclipse.jdt.core.compiler.problem.nullReference=ignore |
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning |
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore |
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore |
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore |
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning |
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore |
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore |
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore |
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore |
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore |
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled |
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning |
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled |
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled |
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore |
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning |
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled |
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning |
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning |
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning |
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning |
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning |
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning |
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore |
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled |
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning |
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning |
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning |
||||
org.eclipse.jdt.core.compiler.processAnnotations=disabled |
||||
org.eclipse.jdt.core.compiler.source=1.8 |
||||
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 |
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 |
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 |
||||
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 |
||||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 |
||||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_method=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_before_package=0 |
||||
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 |
||||
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 |
||||
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line |
||||
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line |
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false |
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false |
||||
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false |
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true |
||||
org.eclipse.jdt.core.formatter.comment.format_header=false |
||||
org.eclipse.jdt.core.formatter.comment.format_html=true |
||||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true |
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=true |
||||
org.eclipse.jdt.core.formatter.comment.format_source_code=false |
||||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true |
||||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false |
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert |
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert |
||||
org.eclipse.jdt.core.formatter.comment.line_length=90 |
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true |
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true |
||||
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false |
||||
org.eclipse.jdt.core.formatter.compact_else_if=true |
||||
org.eclipse.jdt.core.formatter.continuation_indentation=2 |
||||
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 |
||||
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off |
||||
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on |
||||
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false |
||||
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true |
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true |
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true |
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true |
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true |
||||
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true |
||||
org.eclipse.jdt.core.formatter.indent_empty_lines=false |
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true |
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true |
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true |
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false |
||||
org.eclipse.jdt.core.formatter.indentation.size=4 |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert |
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert |
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert |
||||
org.eclipse.jdt.core.formatter.join_lines_in_comments=true |
||||
org.eclipse.jdt.core.formatter.join_wrapped_lines=true |
||||
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false |
||||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false |
||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false |
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false |
||||
org.eclipse.jdt.core.formatter.lineSplit=90 |
||||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false |
||||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false |
||||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 |
||||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines |
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines |
||||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true |
||||
org.eclipse.jdt.core.formatter.tabulation.char=tab |
||||
org.eclipse.jdt.core.formatter.tabulation.size=4 |
||||
org.eclipse.jdt.core.formatter.use_on_off_tags=true |
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false |
||||
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false |
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true |
||||
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true |
||||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true |
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true |
||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter |
File diff suppressed because one or more lines are too long
@ -1,182 +1,145 @@
@@ -1,182 +1,145 @@
|
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Licensed to the Apache Software Foundation (ASF) under one |
||||
@REM or more contributor license agreements. See the NOTICE file |
||||
@REM distributed with this work for additional information |
||||
@REM regarding copyright ownership. The ASF licenses this file |
||||
@REM to you under the Apache License, Version 2.0 (the |
||||
@REM "License"); you may not use this file except in compliance |
||||
@REM with the License. You may obtain a copy of the License at |
||||
@REM |
||||
@REM http://www.apache.org/licenses/LICENSE-2.0 |
||||
@REM |
||||
@REM Unless required by applicable law or agreed to in writing, |
||||
@REM software distributed under the License is distributed on an |
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
@REM KIND, either express or implied. See the License for the |
||||
@REM specific language governing permissions and limitations |
||||
@REM under the License. |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Maven Start Up Batch script |
||||
@REM |
||||
@REM Required ENV vars: |
||||
@REM JAVA_HOME - location of a JDK home dir |
||||
@REM |
||||
@REM Optional ENV vars |
||||
@REM M2_HOME - location of maven2's installed home dir |
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
@REM e.g. to debug Maven itself, use |
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
||||
@echo off |
||||
@REM set title of command window |
||||
title %0 |
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
||||
|
||||
@REM set %HOME% to equivalent of $HOME |
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
||||
|
||||
@REM Execute a user defined script before this one |
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" |
||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" |
||||
:skipRcPre |
||||
|
||||
@setlocal |
||||
|
||||
set ERROR_CODE=0 |
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal |
||||
@setlocal |
||||
|
||||
@REM ==== START VALIDATION ==== |
||||
if not "%JAVA_HOME%" == "" goto OkJHome |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME not found in your environment. >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
:OkJHome |
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
@REM ==== END VALIDATION ==== |
||||
|
||||
:init |
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
||||
@REM Fallback to current working directory if not found. |
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
||||
|
||||
set EXEC_DIR=%CD% |
||||
set WDIR=%EXEC_DIR% |
||||
:findBaseDir |
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
||||
cd .. |
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
||||
set WDIR=%CD% |
||||
goto findBaseDir |
||||
|
||||
:baseDirFound |
||||
set MAVEN_PROJECTBASEDIR=%WDIR% |
||||
cd "%EXEC_DIR%" |
||||
goto endDetectBaseDir |
||||
|
||||
:baseDirNotFound |
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
||||
cd "%EXEC_DIR%" |
||||
|
||||
:endDetectBaseDir |
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion |
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
||||
|
||||
:endReadAdditionalConfig |
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
||||
|
||||
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
||||
) |
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
||||
if exist %WRAPPER_JAR% ( |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Found %WRAPPER_JAR% |
||||
) |
||||
) else ( |
||||
if not "%MVNW_REPOURL%" == "" ( |
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" |
||||
) |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ... |
||||
echo Downloading from: %DOWNLOAD_URL% |
||||
) |
||||
|
||||
powershell -Command "&{"^ |
||||
"$webclient = new-object System.Net.WebClient;"^ |
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
||||
"}"^ |
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
||||
"}" |
||||
if "%MVNW_VERBOSE%" == "true" ( |
||||
echo Finished downloading %WRAPPER_JAR% |
||||
) |
||||
) |
||||
@REM End of extension |
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will |
||||
@REM work with both Windows and non-Windows executions. |
||||
set MAVEN_CMD_LINE_ARGS=%* |
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
||||
if ERRORLEVEL 1 goto error |
||||
goto end |
||||
|
||||
:error |
||||
set ERROR_CODE=1 |
||||
|
||||
:end |
||||
@endlocal & set ERROR_CODE=%ERROR_CODE% |
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost |
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" |
||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" |
||||
:skipRcPost |
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause |
||||
|
||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% |
||||
|
||||
exit /B %ERROR_CODE% |
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Licensed to the Apache Software Foundation (ASF) under one |
||||
@REM or more contributor license agreements. See the NOTICE file |
||||
@REM distributed with this work for additional information |
||||
@REM regarding copyright ownership. The ASF licenses this file |
||||
@REM to you under the Apache License, Version 2.0 (the |
||||
@REM "License"); you may not use this file except in compliance |
||||
@REM with the License. You may obtain a copy of the License at |
||||
@REM |
||||
@REM https://www.apache.org/licenses/LICENSE-2.0 |
||||
@REM |
||||
@REM Unless required by applicable law or agreed to in writing, |
||||
@REM software distributed under the License is distributed on an |
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
@REM KIND, either express or implied. See the License for the |
||||
@REM specific language governing permissions and limitations |
||||
@REM under the License. |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM ---------------------------------------------------------------------------- |
||||
@REM Maven2 Start Up Batch script |
||||
@REM |
||||
@REM Required ENV vars: |
||||
@REM JAVA_HOME - location of a JDK home dir |
||||
@REM |
||||
@REM Optional ENV vars |
||||
@REM M2_HOME - location of maven2's installed home dir |
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending |
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||||
@REM e.g. to debug Maven itself, use |
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
||||
@REM ---------------------------------------------------------------------------- |
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
||||
@echo off |
||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' |
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
||||
|
||||
@REM set %HOME% to equivalent of $HOME |
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
||||
|
||||
@REM Execute a user defined script before this one |
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" |
||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" |
||||
:skipRcPre |
||||
|
||||
@setlocal |
||||
|
||||
set ERROR_CODE=0 |
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal |
||||
@setlocal |
||||
|
||||
@REM ==== START VALIDATION ==== |
||||
if not "%JAVA_HOME%" == "" goto OkJHome |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME not found in your environment. >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
:OkJHome |
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init |
||||
|
||||
echo. |
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
||||
echo location of your Java installation. >&2 |
||||
echo. |
||||
goto error |
||||
|
||||
@REM ==== END VALIDATION ==== |
||||
|
||||
:init |
||||
|
||||
set MAVEN_CMD_LINE_ARGS=%* |
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
||||
@REM Fallback to current working directory if not found. |
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
||||
|
||||
set EXEC_DIR=%CD% |
||||
set WDIR=%EXEC_DIR% |
||||
:findBaseDir |
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
||||
cd .. |
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
||||
set WDIR=%CD% |
||||
goto findBaseDir |
||||
|
||||
:baseDirFound |
||||
set MAVEN_PROJECTBASEDIR=%WDIR% |
||||
cd "%EXEC_DIR%" |
||||
goto endDetectBaseDir |
||||
|
||||
:baseDirNotFound |
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
||||
cd "%EXEC_DIR%" |
||||
|
||||
:endDetectBaseDir |
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion |
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
||||
|
||||
:endReadAdditionalConfig |
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
||||
|
||||
set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" |
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% |
||||
if ERRORLEVEL 1 goto error |
||||
goto end |
||||
|
||||
:error |
||||
set ERROR_CODE=1 |
||||
|
||||
:end |
||||
@endlocal & set ERROR_CODE=%ERROR_CODE% |
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost |
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" |
||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" |
||||
:skipRcPost |
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause |
||||
|
||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% |
||||
|
||||
exit /B %ERROR_CODE% |
||||
|
@ -1,129 +1,40 @@
@@ -1,129 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<artifactId>spring-cloud-dependencies-parent</artifactId> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<version>4.1.0-SNAPSHOT</version> |
||||
<relativePath/> |
||||
</parent> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-commons-dependencies</artifactId> |
||||
<version>4.1.0-SNAPSHOT</version> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
<packaging>pom</packaging> |
||||
<name>spring-cloud-commons-dependencies</name> |
||||
<name>Spring Cloud Commons Dependencies</name> |
||||
<description>Spring Cloud Commons Dependencies</description> |
||||
<url>https://projects.spring.io/spring-cloud/</url> |
||||
<parent> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-dependencies-parent</artifactId> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
<relativePath/> <!-- lookup parent from repository --> |
||||
</parent> |
||||
<properties> |
||||
<spring-security-rsa.version>1.1.1</spring-security-rsa.version> |
||||
<main.basedir>.</main.basedir> |
||||
<bintray.package>commons</bintray.package> |
||||
</properties> |
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.security</groupId> |
||||
<artifactId>spring-security-rsa</artifactId> |
||||
<version>${spring-security-rsa.version}</version> |
||||
<exclusions> |
||||
<exclusion> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-core</artifactId> |
||||
</exclusion> |
||||
<exclusion> |
||||
<groupId>org.springframework.security</groupId> |
||||
<artifactId>spring-security-crypto</artifactId> |
||||
</exclusion> |
||||
</exclusions> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-commons</artifactId> |
||||
<version>${project.version}</version> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-context</artifactId> |
||||
<version>${project.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-loadbalancer</artifactId> |
||||
<version>${project.version}</version> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-starter</artifactId> |
||||
<version>${project.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId> |
||||
<version>${project.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId> |
||||
<version>${project.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-test-support</artifactId> |
||||
<version>${project.version}</version> |
||||
<version>1.0.5.BUILD-SNAPSHOT</version> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
<profiles> |
||||
<profile> |
||||
<id>spring</id> |
||||
<repositories> |
||||
<repository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/snapshot</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
<releases> |
||||
<enabled>false</enabled> |
||||
</releases> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/milestone</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
<repository> |
||||
<id>spring-releases</id> |
||||
<name>Spring Releases</name> |
||||
<url>https://repo.spring.io/release</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</repository> |
||||
</repositories> |
||||
<pluginRepositories> |
||||
<pluginRepository> |
||||
<id>spring-snapshots</id> |
||||
<name>Spring Snapshots</name> |
||||
<url>https://repo.spring.io/snapshot</url> |
||||
<snapshots> |
||||
<enabled>true</enabled> |
||||
</snapshots> |
||||
<releases> |
||||
<enabled>false</enabled> |
||||
</releases> |
||||
</pluginRepository> |
||||
<pluginRepository> |
||||
<id>spring-milestones</id> |
||||
<name>Spring Milestones</name> |
||||
<url>https://repo.spring.io/milestone</url> |
||||
<snapshots> |
||||
<enabled>false</enabled> |
||||
</snapshots> |
||||
</pluginRepository> |
||||
</pluginRepositories> |
||||
</profile> |
||||
</profiles> |
||||
</project> |
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
* Copyright 2019-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
||||
/** |
||||
* Provides a more succinct conditional |
||||
* <code>spring.cloud.discovery.blocking.enabled</code>. |
||||
* |
||||
* @author Tim Ysewyn |
||||
* @since 2.2.0 |
||||
*/ |
||||
@Target(ElementType.TYPE) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@Inherited |
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.blocking.enabled", matchIfMissing = true) |
||||
public @interface ConditionalOnBlockingDiscoveryEnabled { |
||||
|
||||
} |
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
* Copyright 2019-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
||||
/** |
||||
* Provides a more succinct conditional |
||||
* <code>spring.cloud.discovery.client.health-indicator.enabled</code>. |
||||
* |
||||
* @since 2.2.0 |
||||
* @author Tim Ysewyn |
||||
*/ |
||||
@Target({ ElementType.TYPE, ElementType.METHOD }) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@Inherited |
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.client.health-indicator.enabled", matchIfMissing = true) |
||||
public @interface ConditionalOnDiscoveryHealthIndicatorEnabled { |
||||
|
||||
} |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
/* |
||||
* Copyright 2019-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import java.lang.annotation.Documented; |
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
||||
/** |
||||
* Provides a more succinct conditional |
||||
* <code>spring.cloud.discovery.reactive.enabled</code>. Also takes into account whether |
||||
* or not `WebClient` is on the classpath. |
||||
* |
||||
* @author Tim Ysewyn |
||||
* @since 2.2.0 |
||||
*/ |
||||
@Target(ElementType.TYPE) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@Inherited |
||||
@ConditionalOnClass(name = "org.springframework.web.reactive.function.client.WebClient") |
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.reactive.enabled", matchIfMissing = true) |
||||
public @interface ConditionalOnReactiveDiscoveryEnabled { |
||||
|
||||
} |
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import java.util.LinkedHashMap; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.context.properties.bind.Bindable; |
||||
import org.springframework.boot.context.properties.bind.Binder; |
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources; |
||||
import org.springframework.boot.env.EnvironmentPostProcessor; |
||||
import org.springframework.cloud.commons.util.InetUtils; |
||||
import org.springframework.cloud.commons.util.InetUtils.HostInfo; |
||||
import org.springframework.cloud.commons.util.InetUtilsProperties; |
||||
import org.springframework.core.Ordered; |
||||
import org.springframework.core.env.ConfigurableEnvironment; |
||||
import org.springframework.core.env.MapPropertySource; |
||||
|
||||
/** |
||||
* @author Spencer Gibb |
||||
*/ |
||||
public class HostInfoEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { |
||||
|
||||
// Before BootstrapConfigFileApplicationListener
|
||||
private int order = Ordered.HIGHEST_PRECEDENCE + 9; |
||||
|
||||
@Override |
||||
public int getOrder() { |
||||
return this.order; |
||||
} |
||||
|
||||
@Override |
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { |
||||
InetUtils.HostInfo hostInfo = getFirstNonLoopbackHostInfo(environment); |
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<>(); |
||||
map.put("spring.cloud.client.hostname", hostInfo.getHostname()); |
||||
map.put("spring.cloud.client.ip-address", hostInfo.getIpAddress()); |
||||
MapPropertySource propertySource = new MapPropertySource("springCloudClientHostInfo", map); |
||||
environment.getPropertySources().addLast(propertySource); |
||||
} |
||||
|
||||
private HostInfo getFirstNonLoopbackHostInfo(ConfigurableEnvironment environment) { |
||||
InetUtilsProperties target = new InetUtilsProperties(); |
||||
ConfigurationPropertySources.attach(environment); |
||||
Binder.get(environment).bind(InetUtilsProperties.PREFIX, Bindable.ofInstance(target)); |
||||
try (InetUtils utils = new InetUtils(target)) { |
||||
return utils.findFirstNonLoopbackHostInfo(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import java.util.Collection; |
||||
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; |
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
import org.springframework.cloud.client.actuator.HasFeatures; |
||||
import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient; |
||||
import org.springframework.cloud.client.discovery.health.DiscoveryClientHealthIndicatorProperties; |
||||
import org.springframework.cloud.client.discovery.health.reactive.ReactiveDiscoveryCompositeHealthContributor; |
||||
import org.springframework.cloud.client.discovery.health.reactive.ReactiveDiscoveryHealthIndicator; |
||||
import org.springframework.cloud.client.loadbalancer.reactive.ReactiveLoadBalancer; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
/** |
||||
* {@link EnableAutoConfiguration Auto-configuration} for reactive Spring Cloud Commons |
||||
* Client. |
||||
* |
||||
* @author Tim Ysewyn |
||||
* @since 2.2.0 |
||||
*/ |
||||
@Configuration(proxyBeanMethods = false) |
||||
public class ReactiveCommonsClientAutoConfiguration { |
||||
|
||||
@Configuration(proxyBeanMethods = false) |
||||
@EnableConfigurationProperties(DiscoveryClientHealthIndicatorProperties.class) |
||||
@ConditionalOnClass(ReactiveHealthIndicator.class) |
||||
@ConditionalOnBean(ReactiveDiscoveryClient.class) |
||||
@ConditionalOnDiscoveryEnabled |
||||
@ConditionalOnReactiveDiscoveryEnabled |
||||
protected static class ReactiveDiscoveryLoadBalancerConfiguration { |
||||
|
||||
@Bean |
||||
@ConditionalOnProperty(value = "spring.cloud.discovery.client.composite-indicator.enabled", |
||||
matchIfMissing = true) |
||||
@ConditionalOnBean({ ReactiveDiscoveryHealthIndicator.class }) |
||||
public ReactiveDiscoveryCompositeHealthContributor reactiveDiscoveryClients( |
||||
Collection<ReactiveDiscoveryHealthIndicator> indicators) { |
||||
return new ReactiveDiscoveryCompositeHealthContributor(indicators); |
||||
} |
||||
|
||||
@Bean |
||||
public HasFeatures reactiveCommonsFeatures() { |
||||
return HasFeatures.abstractFeatures(ReactiveDiscoveryClient.class, ReactiveLoadBalancer.class); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package org.springframework.cloud.client; |
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
||||
|
||||
import java.lang.annotation.*; |
||||
|
||||
/** |
||||
* @author Spencer Gibb |
||||
*/ |
||||
@Target(ElementType.TYPE) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@Inherited |
||||
@SpringBootApplication |
||||
@EnableDiscoveryClient |
||||
@EnableCircuitBreaker |
||||
public @interface SpringCloudApplication { |
||||
} |
@ -1,179 +0,0 @@
@@ -1,179 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.actuator; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
import org.springframework.beans.BeansException; |
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; |
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.context.ApplicationContextAware; |
||||
|
||||
/** |
||||
* @author Spencer Gibb |
||||
*/ |
||||
@Endpoint(id = "features") |
||||
public class FeaturesEndpoint implements ApplicationContextAware { |
||||
|
||||
private final List<HasFeatures> hasFeaturesList; |
||||
|
||||
private ApplicationContext context; |
||||
|
||||
public FeaturesEndpoint(List<HasFeatures> hasFeaturesList) { |
||||
this.hasFeaturesList = hasFeaturesList; |
||||
} |
||||
|
||||
@Override |
||||
public void setApplicationContext(ApplicationContext context) throws BeansException { |
||||
this.context = context; |
||||
} |
||||
|
||||
@ReadOperation |
||||
public Features features() { |
||||
Features features = new Features(); |
||||
|
||||
for (HasFeatures hasFeatures : this.hasFeaturesList) { |
||||
List<Class<?>> abstractFeatures = hasFeatures.getAbstractFeatures(); |
||||
if (abstractFeatures != null) { |
||||
for (Class<?> clazz : abstractFeatures) { |
||||
addAbstractFeature(features, clazz); |
||||
} |
||||
} |
||||
|
||||
List<NamedFeature> namedFeatures = hasFeatures.getNamedFeatures(); |
||||
if (namedFeatures != null) { |
||||
for (NamedFeature namedFeature : namedFeatures) { |
||||
addFeature(features, namedFeature); |
||||
} |
||||
} |
||||
} |
||||
|
||||
return features; |
||||
} |
||||
|
||||
private void addAbstractFeature(Features features, Class<?> type) { |
||||
String featureName = type.getSimpleName(); |
||||
try { |
||||
Object bean = this.context.getBean(type); |
||||
Class<?> beanClass = bean.getClass(); |
||||
addFeature(features, new NamedFeature(featureName, beanClass)); |
||||
} |
||||
catch (NoSuchBeanDefinitionException e) { |
||||
features.getDisabled().add(featureName); |
||||
} |
||||
} |
||||
|
||||
private void addFeature(Features features, NamedFeature feature) { |
||||
Class<?> type = feature.getType(); |
||||
features.getEnabled().add(new Feature(feature.getName(), type.getCanonicalName(), |
||||
type.getPackage().getImplementationVersion(), type.getPackage().getImplementationVendor())); |
||||
} |
||||
|
||||
static class Features { |
||||
|
||||
final List<Feature> enabled = new ArrayList<>(); |
||||
|
||||
final List<String> disabled = new ArrayList<>(); |
||||
|
||||
public List<Feature> getEnabled() { |
||||
return this.enabled; |
||||
} |
||||
|
||||
public List<String> getDisabled() { |
||||
return this.disabled; |
||||
} |
||||
|
||||
} |
||||
|
||||
static class Feature { |
||||
|
||||
final String type; |
||||
|
||||
final String name; |
||||
|
||||
final String version; |
||||
|
||||
final String vendor; |
||||
|
||||
Feature(String name, String type, String version, String vendor) { |
||||
this.type = type; |
||||
this.name = name; |
||||
this.version = version; |
||||
this.vendor = vendor; |
||||
} |
||||
|
||||
public String getType() { |
||||
return this.type; |
||||
} |
||||
|
||||
public String getName() { |
||||
return this.name; |
||||
} |
||||
|
||||
public String getVersion() { |
||||
return this.version; |
||||
} |
||||
|
||||
public String getVendor() { |
||||
return this.vendor; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Feature{" + "type='" + this.type + '\'' + ", name='" + this.name + '\'' + ", version='" |
||||
+ this.version + '\'' + ", vendor='" + this.vendor + '\'' + '}'; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) { |
||||
if (this == o) { |
||||
return true; |
||||
} |
||||
if (o == null || getClass() != o.getClass()) { |
||||
return false; |
||||
} |
||||
|
||||
Feature feature = (Feature) o; |
||||
|
||||
if (!Objects.equals(this.type, feature.type)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.name, feature.name)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.version, feature.version)) { |
||||
return false; |
||||
} |
||||
return Objects.equals(this.vendor, feature.vendor); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int result = this.type != null ? this.type.hashCode() : 0; |
||||
result = 31 * result + (this.name != null ? this.name.hashCode() : 0); |
||||
result = 31 * result + (this.version != null ? this.version.hashCode() : 0); |
||||
result = 31 * result + (this.vendor != null ? this.vendor.hashCode() : 0); |
||||
return result; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -1,62 +0,0 @@
@@ -1,62 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.actuator; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Spencer Gibb |
||||
*/ |
||||
public class HasFeatures { |
||||
|
||||
private final List<Class<?>> abstractFeatures = new ArrayList<>(); |
||||
|
||||
private final List<NamedFeature> namedFeatures = new ArrayList<>(); |
||||
|
||||
public HasFeatures(List<Class<?>> abstractFeatures, List<NamedFeature> namedFeatures) { |
||||
this.abstractFeatures.addAll(abstractFeatures); |
||||
this.namedFeatures.addAll(namedFeatures); |
||||
} |
||||
|
||||
public static HasFeatures abstractFeatures(Class<?>... abstractFeatures) { |
||||
return new HasFeatures(Arrays.asList(abstractFeatures), Collections.emptyList()); |
||||
} |
||||
|
||||
public static HasFeatures namedFeatures(NamedFeature... namedFeatures) { |
||||
return new HasFeatures(Collections.emptyList(), Arrays.asList(namedFeatures)); |
||||
} |
||||
|
||||
public static HasFeatures namedFeature(String name, Class<?> type) { |
||||
return namedFeatures(new NamedFeature(name, type)); |
||||
} |
||||
|
||||
public static HasFeatures namedFeatures(String name1, Class<?> type1, String name2, Class<?> type2) { |
||||
return namedFeatures(new NamedFeature(name1, type1), new NamedFeature(name2, type2)); |
||||
} |
||||
|
||||
public List<Class<?>> getAbstractFeatures() { |
||||
return this.abstractFeatures; |
||||
} |
||||
|
||||
public List<NamedFeature> getNamedFeatures() { |
||||
return this.namedFeatures; |
||||
} |
||||
|
||||
} |
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.actuator; |
||||
|
||||
/** |
||||
* @author Spencer Gibb |
||||
*/ |
||||
public class NamedFeature { |
||||
|
||||
private final String name; |
||||
|
||||
private final Class<?> type; |
||||
|
||||
public NamedFeature(String name, Class<?> type) { |
||||
this.name = name; |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getName() { |
||||
return this.name; |
||||
} |
||||
|
||||
public Class<?> getType() { |
||||
return this.type; |
||||
} |
||||
|
||||
} |
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
import java.util.function.Consumer; |
||||
import java.util.function.Function; |
||||
|
||||
/** |
||||
* Base class for factories which produce circuit breakers. |
||||
* |
||||
* @author Ryan Baxter |
||||
*/ |
||||
public abstract class AbstractCircuitBreakerFactory<CONF, CONFB extends ConfigBuilder<CONF>> { |
||||
|
||||
private final ConcurrentHashMap<String, CONF> configurations = new ConcurrentHashMap<>(); |
||||
|
||||
/** |
||||
* Adds configurations for circuit breakers. |
||||
* @param ids The id of the circuit breaker |
||||
* @param consumer A configuration builder consumer, allows consumers to customize the |
||||
* builder before the configuration is built |
||||
*/ |
||||
public void configure(Consumer<CONFB> consumer, String... ids) { |
||||
for (String id : ids) { |
||||
CONFB builder = configBuilder(id); |
||||
consumer.accept(builder); |
||||
CONF conf = builder.build(); |
||||
getConfigurations().put(id, conf); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Gets the configurations for the circuit breakers. |
||||
* @return The configurations |
||||
*/ |
||||
protected ConcurrentHashMap<String, CONF> getConfigurations() { |
||||
return configurations; |
||||
} |
||||
|
||||
/** |
||||
* Creates a configuration builder for the given id. |
||||
* @param id The id of the circuit breaker |
||||
* @return The configuration builder |
||||
*/ |
||||
protected abstract CONFB configBuilder(String id); |
||||
|
||||
/** |
||||
* Sets the default configuration for circuit breakers. |
||||
* @param defaultConfiguration A function that returns the default configuration |
||||
*/ |
||||
public abstract void configureDefault(Function<String, CONF> defaultConfiguration); |
||||
|
||||
} |
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
import java.util.function.Function; |
||||
import java.util.function.Supplier; |
||||
|
||||
/** |
||||
* Spring Cloud circuit breaker. |
||||
* |
||||
* @author Ryan Baxter |
||||
*/ |
||||
public interface CircuitBreaker { |
||||
|
||||
default <T> T run(Supplier<T> toRun) { |
||||
return run(toRun, throwable -> { |
||||
throw new NoFallbackAvailableException("No fallback available.", throwable); |
||||
}); |
||||
} |
||||
|
||||
<T> T run(Supplier<T> toRun, Function<Throwable, T> fallback); |
||||
|
||||
} |
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
/** |
||||
* Creates circuit breakers based on the underlying implementation. |
||||
* |
||||
* @author Ryan Baxter |
||||
* @author Andrii Bohutskyi |
||||
*/ |
||||
public abstract class CircuitBreakerFactory<CONF, CONFB extends ConfigBuilder<CONF>> |
||||
extends AbstractCircuitBreakerFactory<CONF, CONFB> { |
||||
|
||||
public abstract CircuitBreaker create(String id); |
||||
|
||||
public CircuitBreaker create(String id, String groupName) { |
||||
return create(id); |
||||
} |
||||
|
||||
} |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
/** |
||||
* A builder for circuit breaker configurations. |
||||
* |
||||
* @author Ryan Baxter |
||||
*/ |
||||
public interface ConfigBuilder<CONF> { |
||||
|
||||
CONF build(); |
||||
|
||||
} |
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
import java.util.concurrent.ConcurrentMap; |
||||
import java.util.function.Function; |
||||
|
||||
/** |
||||
* Customizes the parameterized class. |
||||
* |
||||
* @author Ryan Baxter |
||||
* @author Toshiaki Maki |
||||
*/ |
||||
public interface Customizer<TOCUSTOMIZE> { |
||||
|
||||
void customize(TOCUSTOMIZE tocustomize); |
||||
|
||||
/** |
||||
* Create a wrapped customizer that guarantees that the {@link #customize(Object)} |
||||
* method of the delegated <code>customizer</code> is called at most once per target. |
||||
* @param customizer a customizer to be delegated |
||||
* @param keyMapper a mapping function to produce the identifier of the target |
||||
* @param <T> the type of the target to customize |
||||
* @param <K> the type of the identifier of the target |
||||
* @return a wrapped customizer |
||||
*/ |
||||
static <T, K> Customizer<T> once(Customizer<T> customizer, Function<? super T, ? extends K> keyMapper) { |
||||
final ConcurrentMap<K, Boolean> customized = new ConcurrentHashMap<>(); |
||||
return t -> { |
||||
final K key = keyMapper.apply(t); |
||||
customized.computeIfAbsent(key, k -> { |
||||
customizer.customize(t); |
||||
return true; |
||||
}); |
||||
}; |
||||
} |
||||
|
||||
} |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
/** |
||||
* A runtime exception that tells no fallback is available for the circuit breaker. |
||||
* |
||||
* @author Toshiaki Maki |
||||
*/ |
||||
public class NoFallbackAvailableException extends RuntimeException { |
||||
|
||||
public NoFallbackAvailableException(String message, Throwable cause) { |
||||
super(message, cause); |
||||
} |
||||
|
||||
} |
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
import java.util.function.Function; |
||||
|
||||
import reactor.core.publisher.Flux; |
||||
import reactor.core.publisher.Mono; |
||||
|
||||
/** |
||||
* Spring Cloud reactive circuit breaker API. |
||||
* |
||||
* @author Ryan Baxter |
||||
*/ |
||||
public interface ReactiveCircuitBreaker { |
||||
|
||||
default <T> Mono<T> run(Mono<T> toRun) { |
||||
return run(toRun, throwable -> { |
||||
throw new NoFallbackAvailableException("No fallback available.", throwable); |
||||
}); |
||||
} |
||||
|
||||
<T> Mono<T> run(Mono<T> toRun, Function<Throwable, Mono<T>> fallback); |
||||
|
||||
default <T> Flux<T> run(Flux<T> toRun) { |
||||
return run(toRun, throwable -> { |
||||
throw new NoFallbackAvailableException("No fallback available.", throwable); |
||||
}); |
||||
} |
||||
|
||||
<T> Flux<T> run(Flux<T> toRun, Function<Throwable, Flux<T>> fallback); |
||||
|
||||
} |
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker; |
||||
|
||||
/** |
||||
* Creates reactive circuit breakers. |
||||
* |
||||
* @author Ryan Baxter |
||||
* @author Andrii Bohutskyi |
||||
*/ |
||||
public abstract class ReactiveCircuitBreakerFactory<CONF, CONFB extends ConfigBuilder<CONF>> |
||||
extends AbstractCircuitBreakerFactory<CONF, CONFB> { |
||||
|
||||
public abstract ReactiveCircuitBreaker create(String id); |
||||
|
||||
public ReactiveCircuitBreaker create(String id, String groupName) { |
||||
return create(id); |
||||
} |
||||
|
||||
} |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import io.micrometer.observation.Observation; |
||||
|
||||
/** |
||||
* Circuit Breaker {@link Observation.Context}. |
||||
* |
||||
* @author Marcin Grzejszczak |
||||
* @since 4.0.0 |
||||
*/ |
||||
public class CircuitBreakerObservationContext extends Observation.Context { |
||||
|
||||
private final Type type; |
||||
|
||||
/** |
||||
* Creates a new instance of {@link CircuitBreakerObservationDocumentation}. |
||||
* @param type type of wrapped object |
||||
*/ |
||||
public CircuitBreakerObservationContext(Type type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
/** |
||||
* Gets the wrapped object type. |
||||
* @return type of wrapped object |
||||
*/ |
||||
public Type getType() { |
||||
return type; |
||||
} |
||||
|
||||
/** |
||||
* Describes the type of wrapped object. |
||||
*/ |
||||
public enum Type { |
||||
|
||||
/** |
||||
* Fallback function. |
||||
*/ |
||||
FUNCTION, |
||||
|
||||
/** |
||||
* Operation to run. |
||||
*/ |
||||
SUPPLIER |
||||
|
||||
} |
||||
|
||||
} |
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import io.micrometer.observation.Observation; |
||||
import io.micrometer.observation.ObservationConvention; |
||||
|
||||
/** |
||||
* {@link ObservationConvention} for {@link CircuitBreakerObservationContext}. |
||||
* |
||||
* @author Marcin Grzejszczak |
||||
* @since 4.0.0 |
||||
*/ |
||||
public interface CircuitBreakerObservationConvention extends ObservationConvention<CircuitBreakerObservationContext> { |
||||
|
||||
@Override |
||||
default boolean supportsContext(Observation.Context context) { |
||||
return context instanceof CircuitBreakerObservationContext; |
||||
} |
||||
|
||||
} |
@ -1,83 +0,0 @@
@@ -1,83 +0,0 @@
|
||||
/* |
||||
* Copyright 2013-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import io.micrometer.common.docs.KeyName; |
||||
import io.micrometer.observation.Observation; |
||||
import io.micrometer.observation.ObservationConvention; |
||||
import io.micrometer.observation.docs.ObservationDocumentation; |
||||
|
||||
enum CircuitBreakerObservationDocumentation implements ObservationDocumentation { |
||||
|
||||
/** |
||||
* Observation created when we wrap a Supplier passed to the CircuitBreaker. |
||||
*/ |
||||
CIRCUIT_BREAKER_SUPPLIER_OBSERVATION { |
||||
@Override |
||||
public Class<? extends ObservationConvention<? extends Observation.Context>> getDefaultConvention() { |
||||
return DefaultCircuitBreakerObservationConvention.class; |
||||
} |
||||
|
||||
@Override |
||||
public KeyName[] getLowCardinalityKeyNames() { |
||||
return LowCardinalityTags.values(); |
||||
} |
||||
|
||||
@Override |
||||
public String getPrefix() { |
||||
return "spring.cloud.circuitbreaker"; |
||||
} |
||||
|
||||
}, |
||||
|
||||
/** |
||||
* Observation created when we wrap a Function passed to the CircuitBreaker as |
||||
* fallback. |
||||
*/ |
||||
CIRCUIT_BREAKER_FUNCTION_OBSERVATION { |
||||
@Override |
||||
public Class<? extends ObservationConvention<? extends Observation.Context>> getDefaultConvention() { |
||||
return DefaultCircuitBreakerObservationConvention.class; |
||||
} |
||||
|
||||
@Override |
||||
public KeyName[] getLowCardinalityKeyNames() { |
||||
return LowCardinalityTags.values(); |
||||
} |
||||
|
||||
@Override |
||||
public String getPrefix() { |
||||
return "spring.cloud.circuitbreaker"; |
||||
} |
||||
|
||||
}; |
||||
|
||||
public enum LowCardinalityTags implements KeyName { |
||||
|
||||
/** |
||||
* Defines the type of wrapped lambda. |
||||
*/ |
||||
OBJECT_TYPE { |
||||
@Override |
||||
public String asString() { |
||||
return "spring.cloud.circuitbreaker.type"; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import java.util.Locale; |
||||
|
||||
import io.micrometer.common.KeyValues; |
||||
|
||||
/** |
||||
* Default implementation of {@link CircuitBreakerObservationContext}. |
||||
* |
||||
* @author Marcin Grzejszczak |
||||
* @since 4.0.0 |
||||
*/ |
||||
public class DefaultCircuitBreakerObservationConvention implements CircuitBreakerObservationConvention { |
||||
|
||||
/** |
||||
* Don't know why this needs to be public. |
||||
*/ |
||||
public static final DefaultCircuitBreakerObservationConvention INSTANCE = new DefaultCircuitBreakerObservationConvention(); |
||||
|
||||
@Override |
||||
public KeyValues getLowCardinalityKeyValues(CircuitBreakerObservationContext context) { |
||||
return KeyValues.of(CircuitBreakerObservationDocumentation.LowCardinalityTags.OBJECT_TYPE |
||||
.withValue(context.getType().name().toLowerCase(Locale.ROOT))); |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
return "spring.cloud.circuitbreaker"; |
||||
} |
||||
|
||||
@Override |
||||
public String getContextualName(CircuitBreakerObservationContext context) { |
||||
if (context.getType() == CircuitBreakerObservationContext.Type.SUPPLIER) { |
||||
return "circuit-breaker"; |
||||
} |
||||
return "circuit-breaker fallback"; |
||||
} |
||||
|
||||
} |
@ -1,67 +0,0 @@
@@ -1,67 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import java.util.function.Function; |
||||
import java.util.function.Supplier; |
||||
|
||||
import io.micrometer.observation.ObservationRegistry; |
||||
|
||||
import org.springframework.cloud.client.circuitbreaker.CircuitBreaker; |
||||
|
||||
/** |
||||
* Observed Circuit Breaker. |
||||
* |
||||
* @author Marcin Grzejszczak |
||||
* @since 4.0.0 |
||||
*/ |
||||
public class ObservedCircuitBreaker implements CircuitBreaker { |
||||
|
||||
private final CircuitBreaker delegate; |
||||
|
||||
private final ObservationRegistry observationRegistry; |
||||
|
||||
private CircuitBreakerObservationConvention customConvention; |
||||
|
||||
public ObservedCircuitBreaker(CircuitBreaker delegate, ObservationRegistry observationRegistry) { |
||||
this.delegate = delegate; |
||||
this.observationRegistry = observationRegistry; |
||||
} |
||||
|
||||
@Override |
||||
public <T> T run(Supplier<T> toRun, Function<Throwable, T> fallback) { |
||||
return this.delegate.run( |
||||
new ObservedSupplier<>(this.customConvention, |
||||
new CircuitBreakerObservationContext(CircuitBreakerObservationContext.Type.SUPPLIER), |
||||
"circuit-breaker", this.observationRegistry, toRun), |
||||
new ObservedFunction<>(this.customConvention, |
||||
new CircuitBreakerObservationContext(CircuitBreakerObservationContext.Type.FUNCTION), |
||||
"circuit-breaker fallback", this.observationRegistry, fallback)); |
||||
} |
||||
|
||||
@Override |
||||
public <T> T run(Supplier<T> toRun) { |
||||
return this.delegate.run(new ObservedSupplier<>(this.customConvention, |
||||
new CircuitBreakerObservationContext(CircuitBreakerObservationContext.Type.SUPPLIER), "circuit-breaker", |
||||
this.observationRegistry, toRun)); |
||||
} |
||||
|
||||
public void setCustomConvention(CircuitBreakerObservationConvention customConvention) { |
||||
this.customConvention = customConvention; |
||||
} |
||||
|
||||
} |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import java.util.function.Function; |
||||
|
||||
import io.micrometer.observation.Observation; |
||||
import io.micrometer.observation.ObservationRegistry; |
||||
|
||||
/** |
||||
* Observed {@link Function}. |
||||
* |
||||
* @param <T> type returned by the fallback |
||||
* @since 4.0.0 |
||||
*/ |
||||
class ObservedFunction<T> implements Function<Throwable, T> { |
||||
|
||||
private final Function<Throwable, T> delegate; |
||||
|
||||
private final Observation observation; |
||||
|
||||
ObservedFunction(CircuitBreakerObservationConvention customConvention, CircuitBreakerObservationContext context, |
||||
String conextualName, ObservationRegistry observationRegistry, Function<Throwable, T> toRun) { |
||||
this.delegate = toRun; |
||||
this.observation = CircuitBreakerObservationDocumentation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION |
||||
.observation(customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, () -> context, |
||||
observationRegistry) |
||||
.parentObservation(observationRegistry.getCurrentObservation()); |
||||
this.observation.contextualName(conextualName); |
||||
} |
||||
|
||||
@Override |
||||
public T apply(Throwable throwable) { |
||||
return this.observation.observe(() -> this.delegate.apply(throwable)); |
||||
} |
||||
|
||||
} |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
/* |
||||
* Copyright 2018-2021 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.circuitbreaker.observation; |
||||
|
||||
import java.util.function.Supplier; |
||||
|
||||
import io.micrometer.observation.Observation; |
||||
import io.micrometer.observation.ObservationRegistry; |
||||
|
||||
/** |
||||
* Observed {@link Supplier}. |
||||
* |
||||
* @param <T> type returned by the supplier |
||||
* @since 4.0.0 |
||||
*/ |
||||
class ObservedSupplier<T> implements Supplier<T> { |
||||
|
||||
private final Supplier<T> delegate; |
||||
|
||||
private final Observation observation; |
||||
|
||||
ObservedSupplier(CircuitBreakerObservationConvention customConvention, CircuitBreakerObservationContext context, |
||||
String contextualName, ObservationRegistry observationRegistry, Supplier<T> toRun) { |
||||
this.delegate = toRun; |
||||
this.observation = CircuitBreakerObservationDocumentation.CIRCUIT_BREAKER_SUPPLIER_OBSERVATION |
||||
.observation(customConvention, DefaultCircuitBreakerObservationConvention.INSTANCE, () -> context, |
||||
observationRegistry) |
||||
.parentObservation(observationRegistry.getCurrentObservation()); |
||||
this.observation.contextualName(contextualName); |
||||
} |
||||
|
||||
@Override |
||||
public T get() { |
||||
return this.observation.observe(this.delegate); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,225 @@
@@ -0,0 +1,225 @@
|
||||
/* |
||||
* Copyright 2013-2015 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery; |
||||
|
||||
import javax.annotation.PreDestroy; |
||||
|
||||
import org.springframework.beans.BeansException; |
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
||||
import org.springframework.boot.actuate.autoconfigure.ManagementServerProperties; |
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent; |
||||
import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.context.ApplicationContextAware; |
||||
import org.springframework.context.ApplicationListener; |
||||
import org.springframework.core.env.Environment; |
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
|
||||
/** |
||||
* Lifecycle methods that may be useful and common to various DiscoveryClient implementations. |
||||
* @author Spencer Gibb |
||||
*/ |
||||
public abstract class AbstractDiscoveryLifecycle implements DiscoveryLifecycle, |
||||
ApplicationContextAware, ApplicationListener<EmbeddedServletContainerInitializedEvent> { |
||||
|
||||
private boolean autoStartup = true; |
||||
|
||||
private AtomicBoolean running = new AtomicBoolean(false); |
||||
|
||||
private int order = 0; |
||||
|
||||
private ApplicationContext context; |
||||
|
||||
private Environment environment; |
||||
|
||||
private AtomicInteger port = new AtomicInteger(0); |
||||
|
||||
protected ApplicationContext getContext() { |
||||
return context; |
||||
} |
||||
|
||||
@Override |
||||
public void setApplicationContext(ApplicationContext applicationContext) |
||||
throws BeansException { |
||||
this.context = applicationContext; |
||||
this.environment = this.context.getEnvironment(); |
||||
} |
||||
|
||||
protected Environment getEnvironment() { |
||||
return environment; |
||||
} |
||||
|
||||
protected AtomicInteger getPort() { |
||||
return port; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isAutoStartup() { |
||||
return this.autoStartup; |
||||
} |
||||
|
||||
@Override |
||||
public void stop(Runnable callback) { |
||||
stop(); |
||||
callback.run(); |
||||
} |
||||
|
||||
@Override |
||||
public void start() { |
||||
if (!isEnabled()) { |
||||
return; |
||||
} |
||||
|
||||
// only set the port if the nonSecurePort is 0 and this.port != 0
|
||||
if (this.port.get() != 0 && getConfiguredPort() == 0) { |
||||
setConfiguredPort(this.port.get()); |
||||
} |
||||
// only initialize if nonSecurePort is greater than 0 and it isn't already running
|
||||
// because of containerPortInitializer below
|
||||
if (!this.running.get() && getConfiguredPort() > 0) { |
||||
register(); |
||||
if (shouldRegisterManagement()) { |
||||
registerManagement(); |
||||
} |
||||
this.context .publishEvent(new InstanceRegisteredEvent<>(this, |
||||
getConfiguration())); |
||||
this.running.compareAndSet(false, true); |
||||
} |
||||
} |
||||
|
||||
protected abstract int getConfiguredPort(); |
||||
protected abstract void setConfiguredPort(int port); |
||||
|
||||
/** |
||||
* @return if the management service should be registered with the DiscoveryService |
||||
*/ |
||||
protected boolean shouldRegisterManagement() { |
||||
return getManagementServerProperties() != null |
||||
&& getManagementPort() != null |
||||
&& ManagementServerPortUtils.isDifferent(this.context); |
||||
} |
||||
|
||||
/** |
||||
* @return the object used to configure the DiscoveryClient |
||||
*/ |
||||
protected abstract Object getConfiguration(); |
||||
|
||||
/** |
||||
* Register the local service with the DiscoveryClient |
||||
*/ |
||||
protected abstract void register(); |
||||
|
||||
/** |
||||
* Register the local management service with the DiscoveryClient |
||||
*/ |
||||
protected void registerManagement() { |
||||
} |
||||
|
||||
/** |
||||
* De-register the local service with the DiscoveryClient |
||||
*/ |
||||
protected abstract void deregister(); |
||||
|
||||
/** |
||||
* De-register the local management service with the DiscoveryClient |
||||
*/ |
||||
protected void deregisterManagement() { |
||||
} |
||||
|
||||
/** |
||||
* @return if the DiscoveryClient is enabled |
||||
*/ |
||||
protected abstract boolean isEnabled(); |
||||
|
||||
/** |
||||
* @return the serviceId of the Management Service |
||||
*/ |
||||
protected String getManagementServiceId() { |
||||
return this.context.getId() + ":management"; |
||||
// TODO: configurable management suffix
|
||||
} |
||||
|
||||
/** |
||||
* @return the service name of the Management Service |
||||
*/ |
||||
protected String getManagementServiceName() { |
||||
return getAppName() + ":management"; |
||||
// TODO: configurable management suffix
|
||||
} |
||||
|
||||
/** |
||||
* @return the management server port |
||||
*/ |
||||
protected Integer getManagementPort() { |
||||
return getManagementServerProperties().getPort(); |
||||
} |
||||
|
||||
private ManagementServerProperties getManagementServerProperties() { |
||||
try { |
||||
return this.context.getBean(ManagementServerProperties.class); |
||||
} catch (NoSuchBeanDefinitionException e) { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @return the app name, currently the spring.application.name property |
||||
*/ |
||||
protected String getAppName() { |
||||
return this.environment.getProperty("spring.application.name"); |
||||
} |
||||
|
||||
@Override |
||||
public void stop() { |
||||
if (isEnabled()) { |
||||
deregister(); |
||||
if (shouldRegisterManagement()) { |
||||
deregisterManagement(); |
||||
} |
||||
} |
||||
this.running.compareAndSet(true, false); |
||||
} |
||||
|
||||
@PreDestroy |
||||
public void destroy() { |
||||
stop(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isRunning() { |
||||
return this.running.get(); |
||||
} |
||||
|
||||
@Override |
||||
public int getOrder() { |
||||
return this.order; |
||||
} |
||||
|
||||
@Override |
||||
public int getPhase() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) { |
||||
// TODO: take SSL into account when Spring Boot 1.2 is available
|
||||
this.port.compareAndSet(0, event.getEmbeddedServletContainer().getPort()); |
||||
this.start(); |
||||
} |
||||
} |
@ -1,107 +0,0 @@
@@ -1,107 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery; |
||||
|
||||
import org.apache.commons.logging.Log; |
||||
import org.apache.commons.logging.LogFactory; |
||||
import reactor.core.publisher.Flux; |
||||
import reactor.core.publisher.Mono; |
||||
|
||||
import org.springframework.cloud.client.ServiceInstance; |
||||
import org.springframework.core.Ordered; |
||||
|
||||
/** |
||||
* Represents read operations commonly available to discovery services such as Netflix |
||||
* Eureka or consul.io. |
||||
* |
||||
* @author Tim Ysewyn |
||||
* @author Olga Maciaszek-Sharma |
||||
*/ |
||||
public interface ReactiveDiscoveryClient extends Ordered { |
||||
|
||||
Log LOG = LogFactory.getLog(ReactiveDiscoveryClient.class); |
||||
|
||||
/** |
||||
* Default order of the discovery client. |
||||
*/ |
||||
int DEFAULT_ORDER = 0; |
||||
|
||||
/** |
||||
* A human-readable description of the implementation, used in HealthIndicator. |
||||
* @return The description. |
||||
*/ |
||||
String description(); |
||||
|
||||
/** |
||||
* Gets all ServiceInstances associated with a particular serviceId. |
||||
* @param serviceId The serviceId to query. |
||||
* @return A List of ServiceInstance. |
||||
*/ |
||||
Flux<ServiceInstance> getInstances(String serviceId); |
||||
|
||||
/** |
||||
* @return All known service IDs. |
||||
*/ |
||||
Flux<String> getServices(); |
||||
|
||||
/** |
||||
* Can be used to verify the client is still valid and able to make calls. |
||||
* <p> |
||||
* A successful invocation with no exception thrown implies the client is able to make |
||||
* calls. |
||||
* <p> |
||||
* The default implementation simply calls {@link #getServices()} - client |
||||
* implementations can override with a lighter weight operation if they choose to. |
||||
* @deprecated in favour of {@link ReactiveDiscoveryClient#reactiveProbe()}. This |
||||
* method should not be used as is, as it contains a bug - the method called within |
||||
* returns a {@link Flux}, which is not accessible for subscription or blocking from |
||||
* within. We are leaving it with a deprecation in order not to bring downstream |
||||
* implementations. |
||||
*/ |
||||
@Deprecated |
||||
default void probe() { |
||||
if (LOG.isWarnEnabled()) { |
||||
LOG.warn("ReactiveDiscoveryClient#probe has been called. If you're calling this method directly, " |
||||
+ "use ReactiveDiscoveryClient#reactiveProbe instead."); |
||||
} |
||||
getServices(); |
||||
} |
||||
|
||||
/** |
||||
* Can be used to verify the client is still valid and able to make calls. |
||||
* <p> |
||||
* A successful invocation with no exception thrown implies the client is able to make |
||||
* calls. |
||||
* <p> |
||||
* The default implementation simply calls {@link #getServices()} and wraps it with a |
||||
* {@link Mono} - client implementations can override with a lighter weight operation |
||||
* if they choose to. |
||||
*/ |
||||
default Mono<Void> reactiveProbe() { |
||||
return getServices().then(); |
||||
} |
||||
|
||||
/** |
||||
* Default implementation for getting order of discovery clients. |
||||
* @return order |
||||
*/ |
||||
@Override |
||||
default int getOrder() { |
||||
return DEFAULT_ORDER; |
||||
} |
||||
|
||||
} |
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2023 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery.composite; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.LinkedHashSet; |
||||
import java.util.List; |
||||
|
||||
import org.springframework.cloud.client.ServiceInstance; |
||||
import org.springframework.cloud.client.discovery.DiscoveryClient; |
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator; |
||||
|
||||
/** |
||||
* A {@link DiscoveryClient} that is composed of other discovery clients and delegates |
||||
* calls to each of them in order. |
||||
* |
||||
* @author Biju Kunjummen |
||||
* @author Olga Maciaszek-Sharma |
||||
* @author Sean Ruffatti |
||||
*/ |
||||
public class CompositeDiscoveryClient implements DiscoveryClient { |
||||
|
||||
private final List<DiscoveryClient> discoveryClients; |
||||
|
||||
public CompositeDiscoveryClient(List<DiscoveryClient> discoveryClients) { |
||||
AnnotationAwareOrderComparator.sort(discoveryClients); |
||||
this.discoveryClients = discoveryClients; |
||||
} |
||||
|
||||
@Override |
||||
public String description() { |
||||
return "Composite Discovery Client"; |
||||
} |
||||
|
||||
@Override |
||||
public List<ServiceInstance> getInstances(String serviceId) { |
||||
if (this.discoveryClients != null) { |
||||
for (DiscoveryClient discoveryClient : this.discoveryClients) { |
||||
List<ServiceInstance> instances = discoveryClient.getInstances(serviceId); |
||||
if (instances != null && !instances.isEmpty()) { |
||||
return instances; |
||||
} |
||||
} |
||||
} |
||||
return Collections.emptyList(); |
||||
} |
||||
|
||||
@Override |
||||
public List<String> getServices() { |
||||
LinkedHashSet<String> services = new LinkedHashSet<>(); |
||||
if (this.discoveryClients != null) { |
||||
for (DiscoveryClient discoveryClient : this.discoveryClients) { |
||||
List<String> serviceForClient = discoveryClient.getServices(); |
||||
if (serviceForClient != null) { |
||||
services.addAll(serviceForClient); |
||||
} |
||||
} |
||||
} |
||||
return new ArrayList<>(services); |
||||
} |
||||
|
||||
@Override |
||||
public void probe() { |
||||
if (this.discoveryClients != null) { |
||||
for (DiscoveryClient discoveryClient : this.discoveryClients) { |
||||
discoveryClient.probe(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public List<DiscoveryClient> getDiscoveryClients() { |
||||
return this.discoveryClients; |
||||
} |
||||
|
||||
} |
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery.composite; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
||||
import org.springframework.cloud.client.discovery.DiscoveryClient; |
||||
import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Primary; |
||||
|
||||
/** |
||||
* Auto-configuration for composite discovery client. |
||||
* |
||||
* @author Biju Kunjummen |
||||
*/ |
||||
|
||||
@Configuration(proxyBeanMethods = false) |
||||
@AutoConfigureBefore(SimpleDiscoveryClientAutoConfiguration.class) |
||||
public class CompositeDiscoveryClientAutoConfiguration { |
||||
|
||||
@Bean |
||||
@Primary |
||||
public CompositeDiscoveryClient compositeDiscoveryClient(List<DiscoveryClient> discoveryClients) { |
||||
return new CompositeDiscoveryClient(discoveryClients); |
||||
} |
||||
|
||||
} |
@ -1,73 +0,0 @@
@@ -1,73 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery.composite.reactive; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import reactor.core.publisher.Flux; |
||||
|
||||
import org.springframework.cloud.client.ServiceInstance; |
||||
import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient; |
||||
import org.springframework.cloud.commons.publisher.CloudFlux; |
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator; |
||||
|
||||
/** |
||||
* A {@link ReactiveDiscoveryClient} that is composed of other discovery clients and |
||||
* delegates calls to each of them in order. |
||||
* |
||||
* @author Tim Ysewyn |
||||
*/ |
||||
public class ReactiveCompositeDiscoveryClient implements ReactiveDiscoveryClient { |
||||
|
||||
private final List<ReactiveDiscoveryClient> discoveryClients; |
||||
|
||||
public ReactiveCompositeDiscoveryClient(List<ReactiveDiscoveryClient> discoveryClients) { |
||||
AnnotationAwareOrderComparator.sort(discoveryClients); |
||||
this.discoveryClients = discoveryClients; |
||||
} |
||||
|
||||
@Override |
||||
public String description() { |
||||
return "Composite Reactive Discovery Client"; |
||||
} |
||||
|
||||
@Override |
||||
public Flux<ServiceInstance> getInstances(String serviceId) { |
||||
if (discoveryClients == null || discoveryClients.isEmpty()) { |
||||
return Flux.empty(); |
||||
} |
||||
List<Flux<ServiceInstance>> serviceInstances = new ArrayList<>(); |
||||
for (ReactiveDiscoveryClient discoveryClient : discoveryClients) { |
||||
serviceInstances.add(discoveryClient.getInstances(serviceId)); |
||||
} |
||||
return CloudFlux.firstNonEmpty(serviceInstances); |
||||
} |
||||
|
||||
@Override |
||||
public Flux<String> getServices() { |
||||
if (discoveryClients == null || discoveryClients.isEmpty()) { |
||||
return Flux.empty(); |
||||
} |
||||
return Flux.fromIterable(discoveryClients).flatMap(ReactiveDiscoveryClient::getServices); |
||||
} |
||||
|
||||
public List<ReactiveDiscoveryClient> getDiscoveryClients() { |
||||
return discoveryClients; |
||||
} |
||||
|
||||
} |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery.composite.reactive; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled; |
||||
import org.springframework.cloud.client.ConditionalOnReactiveDiscoveryEnabled; |
||||
import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Primary; |
||||
|
||||
/** |
||||
* Auto-configuration for reactive composite discovery client. |
||||
* |
||||
* @author Tim Ysewyn |
||||
* @since 2.2.0 |
||||
*/ |
||||
@Configuration(proxyBeanMethods = false) |
||||
@ConditionalOnDiscoveryEnabled |
||||
@ConditionalOnReactiveDiscoveryEnabled |
||||
public class ReactiveCompositeDiscoveryClientAutoConfiguration { |
||||
|
||||
@Bean |
||||
@Primary |
||||
public ReactiveCompositeDiscoveryClient reactiveCompositeDiscoveryClient( |
||||
List<ReactiveDiscoveryClient> discoveryClients) { |
||||
return new ReactiveCompositeDiscoveryClient(discoveryClients); |
||||
} |
||||
|
||||
} |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2020 the original author or authors. |
||||
* |
||||
* 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 |
||||
* |
||||
* https://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. |
||||
*/ |
||||
|
||||
package org.springframework.cloud.client.discovery.event; |
||||
|
||||
import org.springframework.cloud.client.serviceregistry.Registration; |
||||
import org.springframework.context.ApplicationEvent; |
||||
|
||||
/** |
||||
* An event to fire before a service is registered. |
||||
* |
||||
* @author Ryan Baxter |
||||
*/ |
||||
public class InstancePreRegisteredEvent extends ApplicationEvent { |
||||
|
||||
private Registration registration; |
||||
|
||||
/** |
||||
* Create a new pre registration event. |
||||
* @param source the object on which the event initially occurred (never {@code null}) |
||||
* @param registration the registration meta data |
||||
*/ |
||||
public InstancePreRegisteredEvent(Object source, Registration registration) { |
||||
super(source); |
||||
this.registration = registration; |
||||
} |
||||
|
||||
/** |
||||
* Get the registration data. |
||||
* @return the registration data |
||||
*/ |
||||
public Registration getRegistration() { |
||||
return this.registration; |
||||
} |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue