Compare commits

..
Author SHA1 Message Date
Olga MaciaszekSharma dedd1f471e Fix after review. 2024-01-25 16:15:41 +01:00
Olga MaciaszekSharma 0dadc2502e Improve documentation on HTTP clients used by EurekaClient. 2024-01-25 14:08:26 +01:00
Ryan Baxter 1c9cd5fb8c Merge branch '4.0.x' 2024-01-23 20:40:20 -05:00
Ryan BaxterandRyan Baxter ab8a02b9bf Remove function and use PropertyResolver (#4240)
This relates to https://github.com/spring-cloud/spring-cloud-config/pull/2375

And reverts part of #4175

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2024-01-23 20:40:04 -05:00
Ryan BaxterandRyan Baxter 05eec78623 Remove function and use PropertyResolver (#4240)
This relates to https://github.com/spring-cloud/spring-cloud-config/pull/2375

And reverts part of #4175

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2024-01-23 20:39:14 -05:00
Olga MaciaszekSharma 2b1e045a55 Publish InstancePreRegisteredEvent. Fixes gh-4237. 2024-01-23 18:38:28 +01:00
Olga MaciaszekSharma 1f97085dff Fix configprops inclusion pattern. Fixes gh-4218. 2024-01-22 18:52:32 +01:00
buildmaster f36102d985 Bumping versions to 4.1.1-SNAPSHOT after release 2023-12-06 15:56:58 +00:00
buildmaster a271879f1d Going back to snapshots 2023-12-06 15:56:58 +00:00
buildmaster 674d19cc79 Update SNAPSHOT to 4.1.0 2023-12-06 15:55:32 +00:00
Olga MaciaszekSharma 36d3e2bd88 Merge remote-tracking branch 'origin/4.0.x' 2023-12-04 18:02:06 +01:00
Olga MaciaszekSharma 12eed88057 Merge remote-tracking branch 'origin/3.1.x' into 4.0.x 2023-12-04 18:01:19 +01:00
dependabot[bot] 12554cbd60 Bump actions/setup-java from 3 to 4 (#4231) 2023-12-04 17:58:13 +01:00
dependabot[bot] ba5b05f9c5 Bump testcontainers.version from 1.19.1 to 1.19.3 (#4225) 2023-11-30 17:42:03 +01:00
buildmaster 1351202d94 Bumping versions 2023-11-14 11:04:10 +00:00
Olga MaciaszekSharma f2edf4b0aa Merge remote-tracking branch 'origin/4.0.x' 2023-11-13 14:18:59 +01:00
Olga MaciaszekSharma f7723e9818 Merge remote-tracking branch 'origin/3.1.x' into 4.0.x 2023-11-13 14:17:50 +01:00
Olga MaciaszekSharma 4112daa5f1 Adjust checkstyle settings. 2023-11-13 14:14:00 +01:00
dependabot[bot] 5c40f13f70 Bump org.mockito:mockito-core from 3.6.0 to 3.6.28 (#4206) 2023-11-13 14:08:05 +01:00
Olga MaciaszekSharma b99ca9d099 Exclude javax servlet-api from deps. 2023-11-13 13:27:23 +01:00
spencergibb 115e210212 Merge branch '4.0.x' 2023-11-10 11:53:24 -05:00
spencergibb c0c2d82368 Excludes jakarta.servlet-api
Fixes gh-4222
2023-11-10 11:53:04 -05:00
Olga MaciaszekSharma 04c35060aa Merge remote-tracking branch 'origin/4.0.x' 2023-11-10 15:43:58 +01:00
Olga Maciaszek-Sharma b7eafdaaeb Make AbstractDiscoveryClientOptionalArgs really optional. (#4221) 2023-11-10 15:43:29 +01:00
Olga MaciaszekSharma 3894f006b6 Merge remote-tracking branch 'origin/4.0.x' 2023-11-09 19:10:38 +01:00
Olga MaciaszekSharma b90a47ff63 Merge remote-tracking branch 'origin/3.1.x' into 4.0.x 2023-11-09 19:04:27 +01:00
Olga MaciaszekSharma 564ac7a1a5 Remove Ribbon mentions. Fixes gh-4219. 2023-11-09 18:55:51 +01:00
Olga MaciaszekSharma e4696d1167 Switch GH actions Java version to Temurin. Remove unused field. 2023-11-03 14:40:25 +01:00
dependabot[bot] 9c5fd4b6f6 Bump org.glassfish.hk2:spring-bridge from 3.0.4 to 3.0.5 (#4216) 2023-11-03 14:21:55 +01:00
dependabot[bot] f2424e6bc3 Bump org.glassfish.hk2:spring-bridge from 3.0.4 to 3.0.5 (#4215) 2023-11-03 14:21:07 +01:00
dependabot[bot] 515c38e18b Bump testcontainers.version from 1.19.0 to 1.19.1 (#4211) 2023-11-03 14:20:40 +01:00
dependabot[bot] a76ddd526a Bump eureka.version from 1.10.17 to 1.10.18 (#4202) 2023-11-03 14:19:48 +01:00
dependabot[bot] fdc37f6d54 Bump actions/setup-java from 2 to 3 (#4198) 2023-11-03 14:19:00 +01:00
dependabot[bot] 28ba6079f0 Bump codecov/codecov-action from 1 to 3 (#4195) 2023-11-03 14:18:15 +01:00
dependabot[bot] 9a3e622742 Bump actions/checkout from 2 to 4 (#4192) 2023-11-03 14:16:59 +01:00
buildmaster 32759b6070 Going back to snapshots 2023-10-31 14:10:58 +00:00
buildmaster f9de1f1a80 Update SNAPSHOT to 4.1.0-RC1 2023-10-31 14:09:43 +00:00
Olga MaciaszekSharma 522905b10c Fix typo. 2023-10-19 13:49:03 +02:00
buildmaster 6a0b7f02b2 Bumping versions 2023-10-13 11:04:26 +00:00
Olga MaciaszekSharma d50ec1c5d0 Fix typo. 2023-10-13 12:36:05 +02:00
Olga MaciaszekSharma ba1f38bd4f Add title to Intro site. 2023-09-28 14:01:15 +02:00
buildmaster f1ecf87454 Going back to snapshots 2023-09-27 11:28:14 +00:00
buildmaster 630151f4ac Update SNAPSHOT to 4.1.0-M2 2023-09-27 11:26:58 +00:00
Olga MaciaszekSharma 1422137333 Merge remote-tracking branch 'origin/4.0.x' 2023-09-26 16:36:49 +02:00
Olga MaciaszekSharma 4f5021e080 Merge remote-tracking branch 'origin/3.1.x' into 4.0.x 2023-09-26 16:33:26 +02:00
Olga MaciaszekSharma c6ed320cb0 Regenerate docs. 2023-09-26 16:33:00 +02:00
Olga MaciaszekSharma 0053b77e2c Revert "Update service discovery feature descriptions in documentation"
This reverts commit 0e5748f505.
Temporariliy revert change till the CLA is signed by the contributor.
2023-09-26 16:30:24 +02:00
Olga MaciaszekSharma 9f3042eedb Merge remote-tracking branch 'origin/3.1.x' into 4.0.x 2023-09-26 16:27:50 +02:00
Olga MaciaszekSharma 9a8a542c32 Merge remote-tracking branch 'origin/3.1.x' into 3.1.x 2023-09-26 16:22:03 +02:00
Olga MaciaszekSharma dd3c86e5ec Rebuild docs. 2023-09-26 16:21:55 +02:00
Nasser Al-den Ghassan Shareef Khaled 0e5748f505 Update service discovery feature descriptions in documentation 2023-09-26 16:14:58 +02:00
dependabot[bot] 04b36a51fd Bump org.bouncycastle:bcpkix-jdk15on from 1.68 to 1.70 (#4203) 2023-09-26 16:04:48 +02:00
dependabot[bot] 1902f02ae8 Bump actions/setup-java from 2 to 3 (#4199) 2023-09-26 15:58:13 +02:00
dependabot[bot] 46199c3cbe Bump org.glassfish.hk2:spring-bridge from 3.0.3 to 3.0.4 (#4205) 2023-09-26 15:49:21 +02:00
dependabot[bot] 95c0c515e3 Bump org.glassfish.hk2:spring-bridge from 3.0.3 to 3.0.4 (#4204) 2023-09-26 15:48:42 +02:00
dependabot[bot] 588f883195 Bump codecov/codecov-action from 1 to 3 (#4197) 2023-09-26 15:47:02 +02:00
dependabot[bot] 534323c1dc Bump testcontainers.version from 1.17.6 to 1.19.0 (#4200) 2023-09-26 15:46:26 +02:00
dependabot[bot] cc0e272563 Bump codecov/codecov-action from 1 to 3 (#4194) 2023-09-26 15:44:17 +02:00
dependabot[bot] ce4eb9889d Bump actions/checkout from 2 to 4 (#4193) 2023-09-26 15:43:48 +02:00
dependabot[bot] 2ecfc7c099 Bump actions/setup-java from 2 to 3 (#4191) 2023-09-26 15:42:52 +02:00
dependabot[bot] ad0d5eb4dc Bump actions/checkout from 2 to 4 (#4190) 2023-09-26 15:42:19 +02:00
spencergibb 715ee973ca Adds antora extension and updates ui version 2023-09-22 15:53:08 -04:00
Olga MaciaszekSharma fecdb42b1e Fix page structure. 2023-09-22 16:59:13 +02:00
Olga MaciaszekSharma 89528befb1 Fix page structure. 2023-09-21 17:45:04 +02:00
Olga MaciaszekSharma c427097aaf Fix page structure. 2023-09-21 17:42:57 +02:00
Olga MaciaszekSharma 22ab50f2b8 Add dependabot.yml. 2023-09-21 17:21:47 +02:00
buildmaster 0eb26f03dd Bumping versions 2023-09-18 14:22:43 +00:00
Olga MaciaszekSharma b8e796ec49 Merge remote-tracking branch 'origin/4.0.x'
# Conflicts:
#	.github/workflows/maven.yml
#	README.adoc
#	docs/pom.xml
#	docs/src/main/asciidoc/README.adoc
#	pom.xml
#	spring-cloud-netflix-dependencies/pom.xml
#	spring-cloud-netflix-eureka-client-tls-tests/pom.xml
#	spring-cloud-netflix-eureka-client/pom.xml
#	spring-cloud-netflix-eureka-server/pom.xml
#	spring-cloud-starter-netflix-eureka-client/pom.xml
#	spring-cloud-starter-netflix-eureka-server/pom.xml
2023-09-18 15:37:16 +02:00
Olga MaciaszekSharma 351b0b7704 Merge remote-tracking branch 'origin/3.1.x' into 4.0.x
# Conflicts:
#	.github/workflows/maven.yml
#	README.adoc
#	docs/pom.xml
#	docs/src/main/asciidoc/README.adoc
#	pom.xml
#	spring-cloud-netflix-dependencies/pom.xml
#	spring-cloud-netflix-eureka-client-tls-tests/pom.xml
#	spring-cloud-netflix-eureka-client/pom.xml
#	spring-cloud-netflix-eureka-server/pom.xml
#	spring-cloud-starter-netflix-eureka-client/pom.xml
#	spring-cloud-starter-netflix-eureka-server/pom.xml
2023-09-18 15:32:38 +02:00
Olga MaciaszekSharma 23259330c9 Do not fail CI on coverage. 2023-09-18 15:27:59 +02:00
Olga MaciaszekSharma c761c1039d Fix readme. 2023-09-18 14:56:27 +02:00
Olga MaciaszekSharma 775fb6a746 Fix readme. 2023-09-18 14:54:21 +02:00
Olga MaciaszekSharma 064197a724 Build with GH actions. 2023-09-18 14:48:06 +02:00
Olga MaciaszekSharma af0fa1c2ab Fix readme. 2023-09-18 14:30:02 +02:00
Olga MaciaszekSharma 968af39cbe Fix GH actions setup. Fix readme. 2023-09-18 14:26:37 +02:00
Olga MaciaszekSharma ec5b5ca53a Build with GitHub Actions. 2023-09-18 14:08:51 +02:00
Olga MaciaszekSharma 78c37a4471 Fix readme. 2023-09-18 14:05:15 +02:00
Olga MaciaszekSharma fd458cf9da Fix readme. 2023-09-18 13:55:53 +02:00
Olga MaciaszekSharma 855e52247b Revert gitignore change. 2023-09-18 13:54:14 +02:00
Olga MaciaszekSharma 528eb9b7d9 Commit partial contents. 2023-09-18 13:53:41 +02:00
Olga MaciaszekSharma 23245b45f3 Build with GitHub Actions. 2023-09-18 13:49:59 +02:00
Olga Maciaszek-Sharma e3ae3925c5 Antora (#4189)
* Migrate Structure

* Insert explicit ids for headers

* Remove unnecessary asciidoc attributes

* Copy default antora files

* Fix indentation for all pages

* Generate a default navigation

* Remove includes

* Fix cross references

* Enable Section Summary TOC for small pages

* Switch docs to Antora.
2023-09-18 13:39:18 +02:00
buildmaster 96832979e3 Bumping versions 2023-07-28 22:05:05 +00:00
buildmaster 651af46efd Bumping versions 2023-07-27 22:05:05 +00:00
buildmaster cf585d124c Bumping versions to 4.0.4-SNAPSHOT after release 2023-07-27 20:25:54 +00:00
buildmaster 056ccfd11a Going back to snapshots 2023-07-27 20:25:54 +00:00
buildmaster 0ebaa0fc2b Update SNAPSHOT to 4.0.3 2023-07-27 20:23:54 +00:00
buildmaster ecfab055f9 Bumping versions 2023-06-30 14:15:10 +00:00
buildmaster 8094476bca Bumping versions 2023-06-29 14:22:11 +00:00
buildmaster b5b0f67ada Bumping versions to 3.1.8-SNAPSHOT after release 2023-06-29 11:24:19 +00:00
buildmaster 209ed2d41c Going back to snapshots 2023-06-29 11:24:19 +00:00
buildmaster 3d27038710 Update SNAPSHOT to 3.1.7 2023-06-29 11:22:46 +00:00
buildmaster 6546901e96 Bumping versions 2023-06-22 22:04:53 +00:00
29 changed files with 668 additions and 183 deletions
-47
View File
@@ -1,47 +0,0 @@
version: 2
jobs:
build:
machine:
image: "ubuntu-2004:202201-02"
environment:
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
TERM: dumb
branches:
ignore:
- gh-pages # list of branches to ignore
steps:
- run:
name: Install OpenJDK 17
command: |
wget -qO - https://adoptium.jfrog.io/adoptium/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptium.jfrog.io/adoptium/deb/
sudo apt-get update && sudo apt-get install temurin-17-jdk
sudo update-alternatives --set java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/temurin-17-jdk-amd64/bin/javac
java -version
- checkout
- restore_cache:
key: sc-netflix-{{ .Branch }}
- run:
name: "Download dependencies"
command: ./mvnw -s .settings.xml -U --fail-never dependency:go-offline || true
- save_cache:
key: sc-netflix-{{ .Branch }}
paths:
- ~/.m2
- run:
name: "Running build"
command: ./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
- run:
name: "Aggregate test results"
when: always
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} ~/junit/ \;
bash <(curl -s https://codecov.io/bash)
- store_artifacts:
path: ~/junit/
destination: artifacts
- store_test_results:
path: ~/junit/
destination: testartifacts
+49
View File
@@ -0,0 +1,49 @@
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 -1
View File
@@ -16,7 +16,7 @@ jobs:
# if: github.repository_owner == 'spring-cloud'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: docs-build
fetch-depth: 1
+33
View File
@@ -0,0 +1,33 @@
# 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 ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ["17"]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: ./mvnw clean install -B -U -P sonar
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
+93 -8
View File
@@ -6,32 +6,117 @@ Edit the files in the src/main/asciidoc/ directory instead.
image::https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/main.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/main"]
image::https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main/graph/badge.svg["Codecov", link="https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main"]
image::https://github.com/spring-cloud/spring-cloud-netflix/actions/workflows/maven.yml/badge.svg?branch=main&style=svg["Build",link="https://github.com/spring-cloud/spring-cloud-netflix/actions/workflows/maven.yml"]
image:https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main/graph/badge.svg["Codecov", link="https://app.codecov.io/gh/spring-cloud/spring-cloud-netflix/tree/main"]
[[features]]
= Features
== Features
* Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans
* Service Discovery: an embedded Eureka server can be created with declarative Java configuration
[[building]]
= Building
== Building
:jdkversion: 17
[[basic-compile-and-test]]
== 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.
The projects that require middleware (i.e. Redis) for testing generally
require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running.
[[documentation]]
== Documentation
The spring-cloud-build module has a "docs" profile, and if you switch
that on it will try to build asciidoc sources using https://docs.antora.org/antora/latest/[Antora] from
`modules/ROOT/`.
As part of that process it will look for a
`docs/src/main/asciidoc/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]]
== 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/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools
should also work without issue as long as they use Maven 3.3.3 or better.
[[activate-the-spring-maven-profile]]
=== Activate the Spring Maven profile
Spring Cloud projects require the 'spring' Maven profile to be activated to resolve
the spring milestone and snapshot repositories. Use your preferred IDE to set this
profile to be active, or you may experience build errors.
[[importing-into-eclipse-with-m2eclipse]]
=== Importing into eclipse with m2eclipse
We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
marketplace".
NOTE: Older versions of m2e do not support Maven 3.3, so once the
projects are imported into Eclipse you will also need to tell
m2eclipse to use the right profile for the projects. If you
see many different errors related to the POMs in the projects, check
that you have an up to date installation. If you can't upgrade m2e,
add the "spring" profile to your `settings.xml`. Alternatively you can
copy the repository settings from the "spring" profile of the parent
pom into your `settings.xml`.
[[importing-into-eclipse-without-m2eclipse]]
=== 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.
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building-jdk8.adoc[]
NOTE: To build the module `spring-cloud-netflix-hystrix-contract` along with the entire Netflix project run the
`build.sh` script in the `scripts` directory.
[[contributing]]
= Contributing
== Contributing
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.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, please find the source code and issue trackers in the project at {github-project}[github].
[[license]]
= License
== License
The project license file is available https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/main/LICENSE.txt[here].
+2 -1
View File
@@ -7,6 +7,7 @@ antora:
- '@antora/atlas-extension'
- require: '@springio/antora-extensions/root-component-extension'
root_component_name: 'cloud-netflix'
- '@springio/antora-extensions/static-page-extension'
site:
title: Spring Cloud Netflix
url: https://docs.spring.io/spring-cloud-netflix/reference/
@@ -35,4 +36,4 @@ runtime:
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.2/ui-bundle.zip
-1
View File
@@ -1 +0,0 @@
spring-cloud-netflix.adoc
+1
View File
@@ -0,0 +1 @@
include::intro.adoc[]
+2
View File
@@ -1,3 +1,5 @@
[[introduction]]
= Spring Cloud Netflix
This project provides Netflix OSS integrations for Spring Boot apps through autoconfiguration
and binding to the Spring Environment and other Spring programming model idioms. With a few
@@ -267,32 +267,38 @@ Do not use the `EurekaClient` in a `@PostConstruct` method or in a `@Scheduled`
It is initialized in a `SmartLifecycle` (with `phase=0`), so the earliest you can rely on it being available is in another `SmartLifecycle` with a higher phase.
====
==== EurekaClient with Jersey
==== Underlying HTTP clients
`EurekaClient` uses either `RestTemplate`, `WebClient` or `JerseyClient` under the hood. In order to use the `EurekaClient`, you need to have one of the supported HTTP clients on your classpath.
To use `RestTemplate`, add `spring-boot-starter-web` to your dependencies. To use `WebClient`, add `spring-boot-starter-webflux` to your dependencies. If both `RestTemplate` and `WebClient` are on the classpath when `eureka.client.webclient.enabled` is set to `true`, `WebClient` is used. Otherwise, `RestTemplate` is used.
By default, EurekaClient uses Spring's `RestTemplate` for HTTP communication.
If you wish to use Jersey instead, you need to add the Jersey dependencies to your classpath.
The following example shows the dependencies you need to add:
[source,xml]
----
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client4</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client4</artifactId>
</dependency>
</dependencies>
----
=== Alternatives to the Native Netflix EurekaClient
You need not use the raw Netflix `EurekaClient`.
Also, it is usually more convenient to use it behind a wrapper of some sort.
Spring Cloud has support for <<spring-cloud-feign, Feign>> (a REST client builder) and <<spring-cloud-ribbon, Spring `RestTemplate`>> through the logical Eureka service identifiers (VIPs) instead of physical URLs.
Spring Cloud has support for <<spring-cloud-feign, Feign>> (a REST client builder) and https://docs.spring.io/spring-cloud-commons/reference/4.1/spring-cloud-commons/loadbalancer.html[Spring Cloud LoadBalancer] through the logical Eureka service identifiers (VIPs) instead of physical URLs.
You can also use the `org.springframework.cloud.client.discovery.DiscoveryClient`, which provides a simple API (not specific to Netflix) for discovery clients, as shown in the following example:
@@ -0,0 +1,259 @@
|===
|Name | Default | Description
|eureka.client.allow-redirects | `+++false+++` | Indicates whether server can redirect a client request to a backup server/cluster. If set to false, the server will handle the request directly, If set to true, it may send HTTP redirect to the client, with a new server location.
|eureka.client.availability-zones | | Gets the list of availability zones (used in AWS data centers) for the region in which this instance resides. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds.
|eureka.client.backup-registry-impl | | Gets the name of the implementation which implements BackupRegistry to fetch the registry information as a fallback option for only the first time when the eureka client starts. This may be needed for applications which needs additional resiliency for registry information without which it cannot operate.
|eureka.client.cache-refresh-executor-exponential-back-off-bound | `+++10+++` | Cache refresh executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred.
|eureka.client.cache-refresh-executor-thread-pool-size | `+++2+++` | The thread pool size for the cacheRefreshExecutor to initialise with.
|eureka.client.client-data-accept | | EurekaAccept name for client data accept.
|eureka.client.decoder-name | | This is a transient config and once the latest codecs are stable, can be removed (as there will only be one).
|eureka.client.disable-delta | `+++false+++` | Indicates whether the eureka client should disable fetching of delta and should rather resort to getting the full registry information. Note that the delta fetches can reduce the traffic tremendously, because the rate of change with the eureka server is normally much lower than the rate of fetches. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds
|eureka.client.dollar-replacement | `+++_-+++` | Get a replacement string for Dollar sign <code>$</code> during serializing/deserializing information in eureka server.
|eureka.client.enabled | `+++true+++` | Flag to indicate that the Eureka client is enabled.
|eureka.client.encoder-name | | This is a transient config and once the latest codecs are stable, can be removed (as there will only be one).
|eureka.client.escape-char-replacement | `+++__+++` | Get a replacement string for underscore sign <code>_</code> during serializing/ deserializing information in eureka server.
|eureka.client.eureka-connection-idle-timeout-seconds | `+++30+++` | Indicates how much time (in seconds) that the HTTP connections to eureka server can stay idle before it can be closed. In the AWS environment, it is recommended that the values is 30 seconds or less, since the firewall cleans up the connection information after a few mins leaving the connection hanging in limbo.
|eureka.client.eureka-server-connect-timeout-seconds | `+++5+++` | Indicates how long to wait (in seconds) before a connection to eureka server needs to timeout. Note that the connections in the client are pooled by {@link HttpClient} and this setting affects the actual connection creation and also the wait time to get the connection from the pool.
|eureka.client.eureka-server-d-n-s-name | | Gets the DNS name to be queried to get the list of eureka servers.This information is not required if the contract returns the service urls by implementing serviceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.
|eureka.client.eureka-server-port | | Gets the port to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS.This information is not required if the contract returns the service urls eurekaServerServiceUrls(String). The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.
|eureka.client.eureka-server-read-timeout-seconds | `+++8+++` | Indicates how long to wait (in seconds) before a read from eureka server needs to timeout.
|eureka.client.eureka-server-total-connections | `+++200+++` | Gets the total number of connections that is allowed from eureka client to all eureka servers.
|eureka.client.eureka-server-total-connections-per-host | `+++50+++` | Gets the total number of connections that is allowed from eureka client to a eureka server host.
|eureka.client.eureka-server-u-r-l-context | | Gets the URL context to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS. This information is not required if the contract returns the service urls from eurekaServerServiceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.
|eureka.client.eureka-service-url-poll-interval-seconds | `+++0+++` | Indicates how often(in seconds) to poll for changes to eureka server information. Eureka servers could be added or removed and this setting controls how soon the eureka clients should know about it.
|eureka.client.fetch-registry | `+++true+++` | Indicates whether this client should fetch eureka registry information from eureka server.
|eureka.client.fetch-remote-regions-registry | | Comma separated list of regions for which the eureka registry information will be fetched. It is mandatory to define the availability zones for each of these regions as returned by availabilityZones. Failing to do so, will result in failure of discovery client startup.
|eureka.client.filter-only-up-instances | `+++true+++` | Indicates whether to get the applications after filtering the applications for instances with only InstanceStatus UP states.
|eureka.client.g-zip-content | `+++true+++` | Indicates whether the content fetched from eureka server has to be compressed whenever it is supported by the server. The registry information from the eureka server is compressed for optimum network traffic.
|eureka.client.healthcheck.enabled | `+++true+++` | Enables the Eureka health check handler.
|eureka.client.heartbeat-executor-exponential-back-off-bound | `+++10+++` | Heartbeat executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred.
|eureka.client.heartbeat-executor-thread-pool-size | `+++2+++` | The thread pool size for the heartbeatExecutor to initialise with.
|eureka.client.initial-instance-info-replication-interval-seconds | `+++40+++` | Indicates how long initially (in seconds) to replicate instance info to the eureka server.
|eureka.client.instance-info-replication-interval-seconds | `+++30+++` | Indicates how often(in seconds) to replicate instance changes to be replicated to the eureka server.
|eureka.client.log-delta-diff | `+++false+++` | Indicates whether to log differences between the eureka server and the eureka client in terms of registry information. Eureka client tries to retrieve only delta changes from eureka server to minimize network traffic. After receiving the deltas, eureka client reconciles the information from the server to verify it has not missed out some information. Reconciliation failures could happen when the client has had network issues communicating to server.If the reconciliation fails, eureka client gets the full registry information. While getting the full registry information, the eureka client can log the differences between the client and the server and this setting controls that. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSecondsr
|eureka.client.on-demand-update-status-change | `+++true+++` | If set to true, local status updates via ApplicationInfoManager will trigger on-demand (but rate limited) register/updates to remote eureka servers.
|eureka.client.order | `+++0+++` | Order of the discovery client used by `CompositeDiscoveryClient` for sorting available clients.
|eureka.client.prefer-same-zone-eureka | `+++true+++` | Indicates whether or not this instance should try to use the eureka server in the same zone for latency and/or other reason. Ideally eureka clients are configured to talk to servers in the same zone The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds
|eureka.client.property-resolver | |
|eureka.client.proxy-host | | Gets the proxy host to eureka server if any.
|eureka.client.proxy-password | | Gets the proxy password if any.
|eureka.client.proxy-port | | Gets the proxy port to eureka server if any.
|eureka.client.proxy-user-name | | Gets the proxy user name if any.
|eureka.client.refresh.enable | `+++true+++` | Determines whether the EurekaClient instance can be refreshed or not(If disabled none of the Eureka client properties will be refreshable).
|eureka.client.region | `+++us-east-1+++` | Gets the region (used in AWS datacenters) where this instance resides.
|eureka.client.register-with-eureka | `+++true+++` | Indicates whether or not this instance should register its information with eureka server for discovery by others. In some cases, you do not want your instances to be discovered whereas you just want do discover other instances.
|eureka.client.registry-fetch-interval-seconds | `+++30+++` | Indicates how often(in seconds) to fetch the registry information from the eureka server.
|eureka.client.registry-refresh-single-vip-address | | Indicates whether the client is only interested in the registry information for a single VIP.
|eureka.client.rest-template-timeout.connect-request-timeout | `+++0+++` |
|eureka.client.rest-template-timeout.connect-timeout | `+++0+++` | Default values are set to 180000, in keeping with {@link RequestConfig} and {@link SocketConfig} defaults.
|eureka.client.rest-template-timeout.socket-timeout | `+++0+++` |
|eureka.client.service-url | | Map of availability zone to list of fully qualified URLs to communicate with eureka server. Each value can be a single URL or a comma separated list of alternative locations. Typically the eureka server URLs carry protocol,host,port,context and version information if any. Example: https://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/ The changes are effective at runtime at the next service url refresh cycle as specified by eurekaServiceUrlPollIntervalSeconds.
|eureka.client.should-enforce-registration-at-init | `+++false+++` | Indicates whether the client should enforce registration during initialization. Defaults to false.
|eureka.client.should-unregister-on-shutdown | `+++true+++` | Indicates whether the client should explicitly unregister itself from the remote server on client shutdown.
|eureka.client.tls.enabled | |
|eureka.client.tls.key-password | |
|eureka.client.tls.key-store | |
|eureka.client.tls.key-store-password | |
|eureka.client.tls.key-store-type | |
|eureka.client.tls.trust-store | |
|eureka.client.tls.trust-store-password | |
|eureka.client.tls.trust-store-type | |
|eureka.client.use-dns-for-fetching-service-urls | `+++false+++` | Indicates whether the eureka client should use the DNS mechanism to fetch a list of eureka servers to talk to. When the DNS name is updated to have additional servers, that information is used immediately after the eureka client polls for that information as specified in eurekaServiceUrlPollIntervalSeconds. Alternatively, the service urls can be returned serviceUrls, but the users should implement their own mechanism to return the updated list in case of changes. The changes are effective at runtime.
|eureka.client.webclient.enabled | `+++false+++` | Enables the use of WebClient for Eureka HTTP Client.
|eureka.dashboard.enabled | `+++true+++` | Flag to enable the Eureka dashboard. Default true.
|eureka.dashboard.path | `+++/+++` | The path to the Eureka dashboard (relative to the servlet path). Defaults to "/".
|eureka.datacenter | `+++default+++` | Eureka datacenter. Defaults to "default".
|eureka.environment | `+++test+++` | Eureka environment. Defaults to "test".
|eureka.instance.a-s-g-name | | Gets the AWS autoscaling group name associated with this instance. This information is specifically used in an AWS environment to automatically put an instance out of service after the instance is launched and it has been disabled for traffic..
|eureka.instance.app-group-name | | Get the name of the application group to be registered with eureka.
|eureka.instance.appname | `+++unknown+++` | Get the name of the application to be registered with eureka.
|eureka.instance.data-center-info | | Returns the data center this instance is deployed. This information is used to get some AWS specific instance information if the instance is deployed in AWS.
|eureka.instance.default-address-resolution-order | `+++[]+++` |
|eureka.instance.environment | |
|eureka.instance.health-check-url | | Gets the absolute health check page URL for this instance. The users can provide the healthCheckUrlPath if the health check page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. <p> It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage. The full URL should follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.
|eureka.instance.health-check-url-path | | Gets the relative health check URL path for this instance. The health check page URL is then constructed out of the hostname and the type of communication - secure or unsecure as specified in securePort and nonSecurePort. It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage.
|eureka.instance.home-page-url | | Gets the absolute home page URL for this instance. The users can provide the homePageUrlPath if the home page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. It is normally used for informational purposes for other services to use it as a landing page. The full URL should follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.
|eureka.instance.home-page-url-path | `+++/+++` | Gets the relative home page URL Path for this instance. The home page URL is then constructed out of the hostName and the type of communication - secure or unsecure. It is normally used for informational purposes for other services to use it as a landing page.
|eureka.instance.hostname | | The hostname if it can be determined at configuration time (otherwise it will be guessed from OS primitives).
|eureka.instance.initial-status | | Initial status to register with remote Eureka server.
|eureka.instance.instance-enabled-onit | `+++false+++` | Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka. Sometimes the application might need to do some pre-processing before it is ready to take traffic.
|eureka.instance.instance-id | | Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.
|eureka.instance.ip-address | | Get the IPAdress of the instance. This information is for academic purposes only as the communication from other instances primarily happen using the information supplied in {@link #getHostName(boolean)}.
|eureka.instance.lease-expiration-duration-in-seconds | `+++90+++` | Indicates the time in seconds that the eureka server waits since it received the last heartbeat before it can remove this instance from its view and there by disallowing traffic to this instance. Setting this value too long could mean that the traffic could be routed to the instance even though the instance is not alive. Setting this value too small could mean, the instance may be taken out of traffic because of temporary network glitches.This value to be set to atleast higher than the value specified in leaseRenewalIntervalInSeconds.
|eureka.instance.lease-renewal-interval-in-seconds | `+++30+++` | Indicates how often (in seconds) the eureka client needs to send heartbeats to eureka server to indicate that it is still alive. If the heartbeats are not received for the period specified in leaseExpirationDurationInSeconds, eureka server will remove the instance from its view, there by disallowing traffic to this instance. Note that the instance could still not take traffic if it implements HealthCheckCallback and then decides to make itself unavailable.
|eureka.instance.metadata-map | | Gets the metadata name/value pairs associated with this instance. This information is sent to eureka server and can be used by other instances.
|eureka.instance.metadata-map.weight | `+++1+++` | The weight of service instance for weighted load balancing.
|eureka.instance.namespace | `+++eureka+++` | Get the namespace used to find properties. Ignored in Spring Cloud.
|eureka.instance.non-secure-port | `+++80+++` | Get the non-secure port on which the instance should receive traffic.
|eureka.instance.non-secure-port-enabled | `+++true+++` | Indicates whether the non-secure port should be enabled for traffic or not.
|eureka.instance.prefer-ip-address | `+++false+++` | Flag to say that, when guessing a hostname, the IP address of the server should be used in preference to the hostname reported by the OS.
|eureka.instance.registry.default-open-for-traffic-count | `+++1+++` | Value used in determining when leases are cancelled, default to 1 for standalone. Should be set to 0 for peer replicated eurekas
|eureka.instance.registry.expected-number-of-clients-sending-renews | `+++1+++` |
|eureka.instance.secure-health-check-url | | Gets the absolute secure health check page URL for this instance. The users can provide the secureHealthCheckUrl if the health check page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. <p> It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage. The full URL should follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.
|eureka.instance.secure-port | `+++443+++` | Get the Secure port on which the instance should receive traffic.
|eureka.instance.secure-port-enabled | `+++false+++` | Indicates whether the secure port should be enabled for traffic or not.
|eureka.instance.secure-virtual-host-name | `+++unknown+++` | Gets the secure virtual host name defined for this instance. This is typically the way other instance would find this instance by using the secure virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.
|eureka.instance.status-page-url | | Gets the absolute status page URL path for this instance. The users can provide the statusPageUrlPath if the status page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. It is normally used for informational purposes for other services to find about the status of this instance. Users can provide a simple HTML indicating what is the current status of the instance.
|eureka.instance.status-page-url-path | | Gets the relative status page URL path for this instance. The status page URL is then constructed out of the hostName and the type of communication - secure or unsecure as specified in securePort and nonSecurePort. It is normally used for informational purposes for other services to find about the status of this instance. Users can provide a simple HTML indicating what is the current status of the instance.
|eureka.instance.virtual-host-name | `+++unknown+++` | Gets the virtual host name defined for this instance. This is typically the way other instance would find this instance by using the virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.
|eureka.server.a-s-g-cache-expiry-timeout-ms | `+++0+++` |
|eureka.server.a-s-g-query-timeout-ms | `+++300+++` |
|eureka.server.a-s-g-update-interval-ms | `+++0+++` |
|eureka.server.a-w-s-access-id | |
|eureka.server.a-w-s-secret-key | |
|eureka.server.batch-replication | `+++false+++` |
|eureka.server.binding-strategy | |
|eureka.server.delta-retention-timer-interval-in-ms | `+++0+++` |
|eureka.server.disable-delta | `+++false+++` |
|eureka.server.disable-delta-for-remote-regions | `+++false+++` |
|eureka.server.disable-transparent-fallback-to-other-region | `+++false+++` |
|eureka.server.e-i-p-bind-rebind-retries | `+++3+++` |
|eureka.server.e-i-p-binding-retry-interval-ms | `+++0+++` |
|eureka.server.e-i-p-binding-retry-interval-ms-when-unbound | `+++0+++` |
|eureka.server.enable-replicated-request-compression | `+++false+++` |
|eureka.server.enable-self-preservation | `+++true+++` |
|eureka.server.eviction-interval-timer-in-ms | `+++0+++` |
|eureka.server.expected-client-renewal-interval-seconds | `+++30+++` |
|eureka.server.g-zip-content-from-remote-region | `+++true+++` |
|eureka.server.initial-capacity-of-response-cache | `+++1000+++` |
|eureka.server.json-codec-name | |
|eureka.server.list-auto-scaling-groups-role-name | `+++ListAutoScalingGroups+++` |
|eureka.server.log-identity-headers | `+++true+++` |
|eureka.server.max-elements-in-peer-replication-pool | `+++10000+++` |
|eureka.server.max-elements-in-status-replication-pool | `+++10000+++` |
|eureka.server.max-idle-thread-age-in-minutes-for-peer-replication | `+++15+++` |
|eureka.server.max-idle-thread-in-minutes-age-for-status-replication | `+++10+++` |
|eureka.server.max-threads-for-peer-replication | `+++20+++` |
|eureka.server.max-threads-for-status-replication | `+++1+++` |
|eureka.server.max-time-for-replication | `+++30000+++` |
|eureka.server.min-available-instances-for-peer-replication | `+++-1+++` |
|eureka.server.min-threads-for-peer-replication | `+++5+++` |
|eureka.server.min-threads-for-status-replication | `+++1+++` |
|eureka.server.my-url | |
|eureka.server.number-of-replication-retries | `+++5+++` |
|eureka.server.peer-eureka-nodes-update-interval-ms | `+++0+++` |
|eureka.server.peer-eureka-status-refresh-time-interval-ms | `+++0+++` |
|eureka.server.peer-node-connect-timeout-ms | `+++200+++` |
|eureka.server.peer-node-connection-idle-timeout-seconds | `+++30+++` |
|eureka.server.peer-node-read-timeout-ms | `+++200+++` |
|eureka.server.peer-node-total-connections | `+++1000+++` |
|eureka.server.peer-node-total-connections-per-host | `+++500+++` |
|eureka.server.prime-aws-replica-connections | `+++true+++` |
|eureka.server.property-resolver | |
|eureka.server.rate-limiter-burst-size | `+++10+++` |
|eureka.server.rate-limiter-enabled | `+++false+++` |
|eureka.server.rate-limiter-full-fetch-average-rate | `+++100+++` |
|eureka.server.rate-limiter-privileged-clients | |
|eureka.server.rate-limiter-registry-fetch-average-rate | `+++500+++` |
|eureka.server.rate-limiter-throttle-standard-clients | `+++false+++` |
|eureka.server.registry-sync-retries | `+++0+++` |
|eureka.server.registry-sync-retry-wait-ms | `+++0+++` |
|eureka.server.remote-region-app-whitelist | |
|eureka.server.remote-region-connect-timeout-ms | `+++1000+++` |
|eureka.server.remote-region-connection-idle-timeout-seconds | `+++30+++` |
|eureka.server.remote-region-fetch-thread-pool-size | `+++20+++` |
|eureka.server.remote-region-read-timeout-ms | `+++1000+++` |
|eureka.server.remote-region-registry-fetch-interval | `+++30+++` |
|eureka.server.remote-region-total-connections | `+++1000+++` |
|eureka.server.remote-region-total-connections-per-host | `+++500+++` |
|eureka.server.remote-region-trust-store | |
|eureka.server.remote-region-trust-store-password | `+++changeit+++` |
|eureka.server.remote-region-urls | |
|eureka.server.remote-region-urls-with-name | |
|eureka.server.renewal-percent-threshold | `+++0.85+++` |
|eureka.server.renewal-threshold-update-interval-ms | `+++0+++` |
|eureka.server.response-cache-auto-expiration-in-seconds | `+++180+++` |
|eureka.server.response-cache-update-interval-ms | `+++0+++` |
|eureka.server.retention-time-in-m-s-in-delta-queue | `+++0+++` |
|eureka.server.route53-bind-rebind-retries | `+++3+++` |
|eureka.server.route53-binding-retry-interval-ms | `+++0+++` |
|eureka.server.route53-domain-t-t-l | `+++30+++` |
|eureka.server.sync-when-timestamp-differs | `+++true+++` |
|eureka.server.use-read-only-response-cache | `+++true+++` |
|eureka.server.wait-time-in-ms-when-sync-empty | `+++0+++` |
|eureka.server.xml-codec-name | |
|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.eureka.approximate-zone-from-hostname | `+++false+++` | Used to determine whether we should try to get the `zone` value from host name.
|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.subset.instance-id | | Instance id of deterministic subsetting. If not set, {@link IdUtils#getDefaultInstanceId(PropertyResolver)} will be used.
|spring.cloud.loadbalancer.subset.size | `+++100+++` | Max subset size of deterministic subsetting.
|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.
|===
+2 -5
View File
@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<packaging>jar</packaging>
@@ -17,10 +17,7 @@
<properties>
<docs.main>spring-cloud-netflix</docs.main>
<main.basedir>${basedir}/..</main.basedir>
<configprops.inclusionPattern>
.*.eureka.*
</configprops.inclusionPattern>
<configprops.inclusionPattern>spring.cloud.*</configprops.inclusionPattern>
<configprops.inclusionPattern>eureka.*|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>
</properties>
+8 -8
View File
@@ -1,30 +1,30 @@
image::https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/main.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/main"]
image::https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main/graph/badge.svg["Codecov", link="https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main"]
image::https://github.com/spring-cloud/spring-cloud-netflix/actions/workflows/maven.yml/badge.svg?branch=main&style=svg["Build",link="https://github.com/spring-cloud/spring-cloud-netflix/actions/workflows/maven.yml"]
image:https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/main/graph/badge.svg["Codecov", link="https://app.codecov.io/gh/spring-cloud/spring-cloud-netflix/tree/main"]
[[features]]
= Features
== Features
* Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans
* Service Discovery: an embedded Eureka server can be created with declarative Java configuration
[[building]]
= Building
== Building
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building-jdk8.adoc[]
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/building.adoc[]
NOTE: To build the module `spring-cloud-netflix-hystrix-contract` along with the entire Netflix project run the
`build.sh` script in the `scripts` directory.
[[contributing]]
= Contributing
== Contributing
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.adoc[]
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/contributing-docs.adoc[]
[[license]]
= License
== License
The project license file is available https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/main/LICENSE.txt[here].
+5 -5
View File
@@ -3,14 +3,14 @@
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>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Cloud Netflix</name>
<description>Spring Cloud Netflix</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath />
</parent>
<scm>
@@ -21,9 +21,9 @@
</scm>
<properties>
<bintray.package>netflix</bintray.package>
<spring-cloud-commons.version>4.1.0-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-config.version>4.1.0-SNAPSHOT</spring-cloud-config.version>
<testcontainers.version>1.17.6</testcontainers.version>
<spring-cloud-commons.version>4.1.1-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-config.version>4.1.1-SNAPSHOT</spring-cloud-config.version>
<testcontainers.version>1.19.3</testcontainers.version>
<mockserverclient.version>5.15.0</mockserverclient.version>
<!-- Sonar -->
+10 -2
View File
@@ -5,11 +5,11 @@
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-netflix-dependencies</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-cloud-netflix-dependencies</name>
<description>Spring Cloud Netflix Dependencies</description>
@@ -51,6 +51,10 @@
<groupId>com.github.vlsi.compactmap</groupId>
<artifactId>compactmap</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
@@ -82,6 +86,10 @@
<groupId>com.netflix.archaius</groupId>
<artifactId>archaius-core</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-netflix-eureka-client-tls-tests</artifactId>
@@ -101,7 +101,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.68</version>
<version>1.70</version>
<scope>test</scope>
</dependency>
</dependencies>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-netflix-eureka-client</artifactId>
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-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.
@@ -257,7 +257,7 @@ public class EurekaClientAutoConfiguration {
@Autowired
private ApplicationContext context;
@Autowired
@Autowired(required = false)
private AbstractDiscoveryClientOptionalArgs<?> optionalArgs;
@Bean(destroyMethod = "shutdown")
@@ -293,7 +293,7 @@ public class EurekaClientAutoConfiguration {
@Autowired
private ApplicationContext context;
@Autowired
@Autowired(required = false)
private AbstractDiscoveryClientOptionalArgs<?> optionalArgs;
@Bean(destroyMethod = "shutdown")
@@ -307,7 +307,7 @@ public class EurekaClientAutoConfiguration {
// problem
// when shutdown is called on the CloudEurekaClient where the
// ApplicationInfoManager bean is
// requested but wont be allowed because we are shutting down. To avoid this
// requested but won't be allowed because we are shutting down. To avoid this
// we use the
// object directly.
ApplicationInfoManager appManager;
@@ -84,8 +84,9 @@ public class EurekaDiscoveryClientConfiguration {
private EurekaAutoServiceRegistration autoRegistration;
public void onApplicationEvent(RefreshScopeRefreshedEvent event) {
// This will force the creation of the EurkaClient bean if not already created
// to make sure the client will be reregistered after a refresh event
// This will force the creation of the EurekaClient bean if not already
// created
// to make sure the client will be re-registered after a refresh event
if (eurekaClient != null) {
eurekaClient.getApplications();
}
@@ -17,18 +17,16 @@
package org.springframework.cloud.netflix.eureka.config;
import java.util.Collections;
import java.util.List;
import com.netflix.discovery.shared.transport.EurekaHttpClient;
import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapContext;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.BootstrapRegistryInitializer;
import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.config.client.ConfigClientProperties;
import org.springframework.cloud.config.client.ConfigServerConfigDataLocationResolver.PropertyResolver;
import org.springframework.cloud.config.client.ConfigServerInstanceProvider;
import org.springframework.cloud.configuration.TlsProperties;
import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
@@ -45,52 +43,39 @@ public class EurekaConfigServerBootstrapper implements BootstrapRegistryInitiali
return;
}
// It is important that we pass a lambda for the Function or else we will get a
// ClassNotFoundException when config is not on the classpath
registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, EurekaFunction::create);
}
private static Boolean getDiscoveryEnabled(Binder binder) {
return binder.bind(ConfigClientProperties.CONFIG_DISCOVERY_ENABLED, Boolean.class).orElse(false)
&& binder.bind("eureka.client.enabled", Boolean.class).orElse(true)
&& binder.bind("spring.cloud.discovery.enabled", Boolean.class).orElse(true);
}
final static class EurekaFunction implements ConfigServerInstanceProvider.Function {
private final BootstrapContext context;
static EurekaFunction create(BootstrapContext context) {
return new EurekaFunction(context);
}
private EurekaFunction(BootstrapContext context) {
this.context = context;
}
@Override
public List<ServiceInstance> apply(String serviceId, Binder binder, BindHandler bindHandler, Log log) {
if (binder == null || !getDiscoveryEnabled(binder)) {
return Collections.emptyList();
registry.registerIfAbsent(EurekaClientConfigBean.class, context -> {
if (!getDiscoveryEnabled(context)) {
return null;
}
PropertyResolver propertyResolver = getPropertyResolver(context);
return propertyResolver.resolveConfigurationProperties(EurekaClientConfigBean.PREFIX,
EurekaClientConfigBean.class, EurekaClientConfigBean::new);
});
EurekaClientConfigBean config = binder.bind(EurekaClientConfigBean.PREFIX, EurekaClientConfigBean.class)
.orElseGet(EurekaClientConfigBean::new);
registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, context -> {
if (!getDiscoveryEnabled(context)) {
return (id) -> Collections.emptyList();
}
EurekaClientConfigBean config = context.get(EurekaClientConfigBean.class);
EurekaHttpClient httpClient = new RestTemplateTransportClientFactory(
context.getOrElse(TlsProperties.class, null),
context.getOrElse(EurekaClientHttpRequestFactorySupplier.class,
new DefaultEurekaClientHttpRequestFactorySupplier()))
.newClient(HostnameBasedUrlRandomizer.randomEndpoint(config, binder));
return new EurekaConfigServerInstanceProvider(httpClient, config).getInstances(serviceId);
}
new DefaultEurekaClientHttpRequestFactorySupplier())).newClient(
HostnameBasedUrlRandomizer.randomEndpoint(config, getPropertyResolver(context)));
return new EurekaConfigServerInstanceProvider(httpClient, config)::getInstances;
});
}
@Override
public List<ServiceInstance> apply(String serviceId) {
// This should never be called now but is here for backward
// compatibility
return apply(serviceId, null, null, null);
}
private static PropertyResolver getPropertyResolver(BootstrapContext context) {
return context.getOrElseSupply(PropertyResolver.class,
() -> new PropertyResolver(context.get(Binder.class), context.getOrElse(BindHandler.class, null)));
}
public static Boolean getDiscoveryEnabled(BootstrapContext bootstrapContext) {
PropertyResolver propertyResolver = getPropertyResolver(bootstrapContext);
return propertyResolver.get(ConfigClientProperties.CONFIG_DISCOVERY_ENABLED, Boolean.class, false)
&& propertyResolver.get("eureka.client.enabled", Boolean.class, true)
&& propertyResolver.get("spring.cloud.discovery.enabled", Boolean.class, true);
}
}
@@ -23,12 +23,15 @@ import com.netflix.discovery.endpoint.EndpointUtils;
import com.netflix.discovery.shared.resolver.DefaultEndpoint;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.cloud.config.client.ConfigServerConfigDataLocationResolver.PropertyResolver;
import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
public final class HostnameBasedUrlRandomizer implements EndpointUtils.ServiceUrlRandomizer {
private static final String EUREKA_INSTANCE_HOSTNAME = "eureka.instance.hostname";
private final String hostname;
HostnameBasedUrlRandomizer(String hostname) {
@@ -64,12 +67,17 @@ public final class HostnameBasedUrlRandomizer implements EndpointUtils.ServiceUr
}
public static DefaultEndpoint randomEndpoint(EurekaClientConfig config, Environment env) {
String hostname = env.getProperty("eureka.instance.hostname");
String hostname = env.getProperty(EUREKA_INSTANCE_HOSTNAME);
return new DefaultEndpoint(getEurekaUrl(config, hostname));
}
public static DefaultEndpoint randomEndpoint(EurekaClientConfig config, Binder binder) {
String hostname = binder.bind("eureka.instance.hostname", String.class).orElseGet(() -> null);
String hostname = binder.bind(EUREKA_INSTANCE_HOSTNAME, String.class).orElseGet(() -> null);
return new DefaultEndpoint(getEurekaUrl(config, hostname));
}
public static DefaultEndpoint randomEndpoint(EurekaClientConfig config, PropertyResolver propertyResolver) {
String hostname = propertyResolver.get(EUREKA_INSTANCE_HOSTNAME, String.class, null);
return new DefaultEndpoint(getEurekaUrl(config, hostname));
}
@@ -30,8 +30,6 @@ import com.netflix.discovery.shared.transport.EurekaHttpClient;
import com.netflix.discovery.shared.transport.EurekaHttpResponse;
import com.netflix.discovery.shared.transport.EurekaHttpResponse.EurekaHttpResponseBuilder;
import com.netflix.discovery.util.StringUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -48,8 +46,6 @@ import static com.netflix.discovery.shared.transport.EurekaHttpResponse.anEureka
*/
public class RestTemplateEurekaHttpClient implements EurekaHttpClient {
protected final Log logger = LogFactory.getLog(getClass());
private final RestTemplate restTemplate;
private String serviceUrl;
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-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.
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.cloud.client.discovery.event.InstancePreRegisteredEvent;
import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
import org.springframework.cloud.client.serviceregistry.AutoServiceRegistration;
import org.springframework.context.ApplicationContext;
@@ -33,11 +34,15 @@ import org.springframework.context.event.SmartApplicationListener;
import org.springframework.core.Ordered;
/**
* Provides an implementation of {@link AutoServiceRegistration} for registering service
* instances in Eureka.
*
* @author Dave Syer
* @author Spencer Gibb
* @author Jon Schneider
* @author Jakub Narloch
* @author Raiyan Raiyan
* @author Olga Maciaszek-Sharma
*/
public class EurekaAutoServiceRegistration
implements AutoServiceRegistration, SmartLifecycle, Ordered, SmartApplicationListener {
@@ -65,37 +70,38 @@ public class EurekaAutoServiceRegistration
@Override
public void start() {
// only set the port if the nonSecurePort or securePort is 0 and this.port != 0
if (this.port.get() != 0) {
if (this.registration.getNonSecurePort() == 0) {
this.registration.setNonSecurePort(this.port.get());
// only set the port if the nonSecurePort or securePort is 0 and port != 0
if (port.get() != 0) {
if (registration.getNonSecurePort() == 0) {
registration.setNonSecurePort(port.get());
}
if (this.registration.getSecurePort() == 0 && this.registration.isSecure()) {
this.registration.setSecurePort(this.port.get());
if (registration.getSecurePort() == 0 && registration.isSecure()) {
registration.setSecurePort(port.get());
}
}
// only initialize if nonSecurePort is greater than 0 and it isn't already running
// because of containerPortInitializer below
if (!this.running.get() && this.registration.getNonSecurePort() > 0) {
if (!running.get() && registration.getNonSecurePort() > 0) {
context.publishEvent(new InstancePreRegisteredEvent(this, registration));
this.serviceRegistry.register(this.registration);
serviceRegistry.register(registration);
this.context.publishEvent(new InstanceRegisteredEvent<>(this, this.registration.getInstanceConfig()));
this.running.set(true);
context.publishEvent(new InstanceRegisteredEvent<>(this, registration.getInstanceConfig()));
running.set(true);
}
}
@Override
public void stop() {
this.serviceRegistry.deregister(this.registration);
this.running.set(false);
serviceRegistry.deregister(registration);
running.set(false);
}
@Override
public boolean isRunning() {
return this.running.get();
return running.get();
}
@Override
@@ -116,7 +122,7 @@ public class EurekaAutoServiceRegistration
@Override
public int getOrder() {
return this.order;
return order;
}
@Override
@@ -140,9 +146,9 @@ public class EurekaAutoServiceRegistration
String contextName = event.getApplicationContext().getServerNamespace();
if (contextName == null || !contextName.equals("management")) {
int localPort = event.getWebServer().getPort();
if (this.port.get() == 0) {
if (port.get() == 0) {
log.info("Updating port to " + localPort);
this.port.compareAndSet(0, localPort);
port.compareAndSet(0, localPort);
start();
}
}
@@ -12,12 +12,6 @@
"description": "Determines whether the EurekaClient instance can be refreshed or not(If disabled none of the Eureka client properties will be refreshable).",
"type": "java.lang.Boolean"
},
{
"defaultValue": true,
"name": "ribbon.eureka.enabled",
"description": "Enables the use of Eureka with Ribbon.",
"type": "java.lang.Boolean"
},
{
"defaultValue": false,
"name": "eureka.client.webclient.enabled",
@@ -0,0 +1,106 @@
/*
* Copyright 2013-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.netflix.eureka.serviceregistry;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.cloud.client.discovery.event.InstancePreRegisteredEvent;
import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
import org.springframework.cloud.client.serviceregistry.Registration;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link EurekaAutoServiceRegistration}.
*
* @author Olga Maciaszek-Sharma
*/
@SpringBootTest(classes = EurekaAutoServiceRegistrationIntegrationTests.Config.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class EurekaAutoServiceRegistrationIntegrationTests {
@LocalServerPort
private int serverPort;
@Autowired
private PreEventListener preEventListener;
@Autowired
private PostEventListener postEventListener;
@Test
void shouldPublishRegistrationEvents() {
assertThat(preEventListener.wasFired).isTrue();
assertThat(preEventListener.registration).isInstanceOf(EurekaRegistration.class);
assertThat(preEventListener.registration.getPort()).isEqualTo(serverPort);
assertThat(postEventListener.wasFired).isTrue();
assertThat(postEventListener.config.getNonSecurePort()).isEqualTo(serverPort);
}
@EnableAutoConfiguration
@Configuration(proxyBeanMethods = false)
public static class Config {
@Bean
public PreEventListener preRegisterListener() {
return new PreEventListener();
}
@Bean
public PostEventListener postEventListener() {
return new PostEventListener();
}
}
public static class PreEventListener implements ApplicationListener<InstancePreRegisteredEvent> {
public boolean wasFired = false;
public Registration registration;
@Override
public void onApplicationEvent(InstancePreRegisteredEvent event) {
this.registration = event.getRegistration();
this.wasFired = true;
}
}
public static class PostEventListener implements ApplicationListener<InstanceRegisteredEvent> {
public boolean wasFired = false;
public EurekaInstanceConfigBean config;
@Override
public void onApplicationEvent(InstanceRegisteredEvent event) {
this.config = (EurekaInstanceConfigBean) event.getConfig();
this.wasFired = true;
}
}
}
@@ -1,9 +1,4 @@
# for EurekaRibbonClientPropertyOverrideIntegrationTests
foo3:
ribbon:
NFLoadBalancerPingClassName: com.netflix.loadbalancer.DummyPing
NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
security:
basic:
enabled: false
+2 -2
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-netflix-eureka-server</artifactId>
@@ -76,7 +76,7 @@
<groupId>org.glassfish.hk2</groupId>
<artifactId>spring-bridge</artifactId>
<!-- FIXME: 4.0 -->
<version>3.0.3</version>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
@@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
</parent>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<name>Spring Cloud Starter Netflix Eureka Client</name>
@@ -3,7 +3,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
</parent>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<name>Spring Cloud Starter Netflix Eureka Server</name>
@@ -13,4 +13,5 @@
<suppress files=".*TestAutoConfiguration\.java" checks="JavadocStyle"/>
<suppress files=".*TestAutoConfiguration\.java" checks="JavadocStyle"/>
<suppress files=".*Tests\.java" checks="JavadocVariable"/>
<suppress files=".*EurekaConfigServerBootstrapperIT\.java" checks="JavadocVariable"/>
</suppressions>