Commit Graph

212 Commits

Author SHA1 Message Date
Olga Maciaszek-Sharma
07e29944a2 Add more hints. 2022-10-05 18:51:28 +02:00
Olga Maciaszek-Sharma
1b110c87ad Add first hints. 2022-10-05 15:00:02 +02:00
Ryan Baxter
8de4b27ee3 Migrate to new autoconfiguration (#2137) 2022-08-24 14:18:40 -04:00
buildmaster
27acb917ce Bumping versions 2022-05-11 02:50:42 +00:00
spencergibb
ed2f2cc20a log retry context 2022-05-09 13:39:26 -04:00
spencergibb
a49a9d13d7 Fixes config data log constructor.
Also, compatibility with framework 6/boot 3
2022-05-09 12:58:51 -04:00
spencergibb
a613db4e06 Merge branch '3.1.x' 2022-05-09 12:24:29 -04:00
spencergibb
70e558df7d Removes unused constructor 2022-05-09 12:22:41 -04:00
Ryan Baxter
60852ce476 Fixing tests 2022-04-26 20:54:44 -04:00
Ryan Baxter
dbb3dcaafb Removing the use of getRawStatusCode 2022-04-26 12:46:21 -04:00
Ryan Baxter
3e1322be36 Merge branch '3.1.x' 2022-03-22 09:29:22 -04:00
ruansheng
9cfa39377e Fix configServer logger (#2066) 2022-03-22 09:28:25 -04:00
marnee01
7f83b1f547 Add support for multiple-url-strategy configuration for clients. (#1946)
* Add support for multiple-url-strategy configuration for clients.

Add support for new property spring.cloud.config.multiple-uri-strategy.
The value must be one of: always, connection_timeout_only. The default
value is connection_timeout_only. This default setting maintains existing
behavior.

If a client has multiple URLs in the spring.cloud.config.uri property,
and if multiple-uri-strategy is set to "always", then if the client gets
any error from config server whatsoever or gets no response, the client
will try the next URL in the list.

The existing and default behavior is that the other URLs in the list will be
tried only if and when the client receives no response from config server.

This is mainly to allow for a client failing over to secondary URLs when
it receives a 404 due to config server being unable to reach its git server
(and config server does not have the requested configs in its local git cache).
With the default behavior, the client receives a 404 and never tries the
next URL in the list(which might point to a different git server that is
currently up). Another benefit is that it allows for a client failing over
to a secondary config server if the first one returns a 503 (OUT_OF_SERVICE).

Fixes gh-1845.

* Fix code style after committing change for gh-1845.

* Fix support for multiple-url-strategy configuration for clients.

Fix issue with the new multiple URI strategy behavior.
Even when strategy was ALWAYS, the client would not try
the next URL when it received server-side errors. Fixed
this by adding HttpServerErrorException to catch clause
in ConfigServicePropertySourceLocator.

Also, fix code style issues and add unit tests.
Fix existing fail-fast unit tests that were not correct.
(They were not mocking out raw status code method on
the response. The error thrown back was actually due to
RestTemplate.handleResponse being unable to to map raw
status code 0 to an HttpStatus.)

* Fix support for multiple-url-strategy configuration for clients.

Merge with dev and undo unintentional changes that were
done automatically. This is part of the pull request
fixing gh-1845.

* Fix support for multiple-url-strategy configuration for clients.

Update ConfigServerConfigDataLoader to try multiple URLs
even for server-side errors when strategy is ALWAYS. This was
missed in previous commit. This is part of the pull request
fixing gh-1845.

* Add ConfigServerConfigDataLoaderTests.

When ConfigServerConfigDataLoader was originally introduced
for the new Spring Boot 2.4 way to import configuration data
(https://github.com/spring-cloud/spring-cloud-config/pull/1656/files),
no unit test was added. I needed to add tests to cover changes
made for the new MultipleUriStrategy (gh-1845). I copied
tests from ConfigServicePropertySourceLocatorTests and modified
as needed for the new class. (There were 2-3 test cases from
ConfigServicePropertySourceLocatorTests that I did not
copy over because it wasn't clear to me expected behavior
or how to set up test case).

This is part of the pull request fixing gh-1845.

* Update the default for multiple-uri-strategy to ALWAYS.

(Per code review.) This is part of the pull request fixing
gh-1845.

* Update documentation for the new multiple-uri-strategy property.

Also, add documentation comparing behavior of multiple URLs
under spring.cloud.config.uri versus multiple URLs under
spring.config.import.

This is part of the pull request fixing gh-1845.

Co-authored-by: UPINCMA <marnee.derider@pearson.com>
2022-03-07 17:07:41 -05:00
buildmaster
de84be1011 Bumping versions 2022-02-24 02:37:29 +00:00
buildmaster
9e7fd9117a Bumping versions 2022-02-24 00:30:01 +00:00
Sergii Chekotylo
d0b9f0a6c8 Unable to provide different values of spring.config.import.configserver since 2020.0.4 #2011 (#2037) 2022-02-22 11:05:29 -05:00
Sergii Chekotylo
cee78ddd86 Unable to provide different values of spring.config.import.configserver since 2020.0.4 #2011 (#2037) 2022-02-22 11:04:32 -05:00
Ryan Baxter
470375c246 Merge remote-tracking branch 'origin/3.1.x' into main 2022-01-31 14:51:50 -05:00
Mark Bonnekessel
b5ac671671 Add Option.PROFILE_SPECIFIC to profile specific PropertySources from Vault
Fixes gh-1997
2022-01-31 12:04:37 -05:00
spencergibb
fda8368355 Updates to 4.0.0-SNAPSHOT
Updates for java 17, framework 6, boot 3 and javax->jakarta
2022-01-04 11:38:09 -05:00
spencergibb
0e2c4fccd1 merge FailureAnalyzer entries 2021-07-27 23:39:40 -04:00
spencergibb
fd35b6ecbd formatting 2021-07-27 23:21:51 -04:00
spencergibb
52449c06c0 Migrates tests to junit 5 and updated for bootstrap 2021-07-27 23:20:18 -04:00
spencergibb
ede086893b Merge branch 'GH-1586' of https://github.com/Walliee/spring-cloud-config into Walliee-GH-1586 2021-07-27 22:58:04 -04:00
Ryan Baxter
719e06950c Use ConfigClientProperties if it exists in the BootstrapContext (#1931)
* Use ConfigClientProperties if it exists in the BootstrapContext before creating a new one.  Fixes  #1919

* Add back test, have one test use uri from properties
2021-07-16 12:02:40 -04:00
spencergibb
e645c80215 Adds tests for retry properties in import url.
See gh-1797
2021-05-26 11:32:00 -04:00
spencergibb
e9fa34032b Adds support for retry in profile specific properties.
in application-<profile>.{properties|yaml}

spring.config.import=configserver:http://configserver.example.com?fail-fast=true&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=1100"

This required that the RetryTemplate be created as late as possible and it is no longer put in the bootstrap context. A RetryTemplateFactory was created so the LoaderInterceptor and the ConfigServerInstanceProvider can create a RetryTemplate. ConfigServerConfigDataLocationResolver creates RetryProperties from the url parameters if they are provided.

ConfigServerConfigDataLoader now creates a ConfigClientFailFastException and registers it in the application context rather and returns an empty ConfigData rather than throwing and exception. Then in ConfigClientAutoConfiguration an ApplicationStartedEvent is listened for and if the fail fast exception is there, throws it halting execution. This all allows logging in ConfigData to show.

Fixes gh-1797
2021-05-26 11:31:03 -04:00
spencergibb
529afcda4d remove errant comment 2021-05-24 13:20:41 -04:00
spencergibb
42546c813e Migrate from deprecated Bootstrapper to BootstrapRegistryInitializer
Fixes gh-1890
2021-05-24 13:02:10 -04:00
spencergibb
be708efc18 Use boot config data api to determine resource and location.
Previously the resource name and location needed to be parsed. This change updates NativeEnvironmentRepository to pass a ConfigDataEnvironmentUpdateListener to ConfigDataEnvironmentPostProcessor.applyTo() and match PropertySources to location and resource. PassthruEnvironmentRepository is updated to attach the original PropertySource to use later in the clean() method to retrieve the location and resource avoiding parsing.

Fixes gh-1875
2021-05-05 14:12:06 -04:00
spencergibb
3056d5f842 Fixes profile ordering of remote vs local.
Previously a local profiles specific file would have more priority than a remote profile specific file. Using a new ConfigData Option, this is now fixed.

Fixes gh-1795
2021-04-08 17:39:32 -04:00
Ryan Baxter
a57b465638 Take into account config data in list format (#1853) 2021-03-31 07:01:24 -04:00
spencergibb
50d2f9d334 formatting 2021-03-29 18:07:17 -04:00
spencergibb
9b9b6838b6 Merge branch '2.2.x' 2021-03-29 18:06:37 -04:00
spencergibb
f4aab7f15d Adds support for uri encoded username/password
Fixes gh-1621
2021-03-29 18:05:06 -04:00
spencergibb
62c96d059c removes todo that has been completed 2021-03-15 20:56:20 -04:00
Ryan Baxter
964238a5f2 Use property source name in ConfigServerConfigDataLocator 2021-03-15 19:35:26 -04:00
Ryan Baxter
7f17b77853 Get all property sources for bootstrap, configserver, and configclient in health indicator 2021-03-15 16:42:41 -04:00
spencergibb
03cdebcffd Adds resource to logging 2021-03-12 18:49:39 -05:00
spencergibb
4010a7cf7c Adds support for Tls to config data.
Moves common setup to new ConfigClientRequestTemplateFactory class that was replicated between two implementations.

Fixes gh-1689
2021-03-12 18:31:25 -05:00
buildmaster
35f219c296 Bumping versions 2021-03-11 09:59:24 +00:00
spencergibb
df5bda79ff Fixes test to mock RestTemplate response. 2021-03-10 18:48:06 -05:00
spencergibb
a09d4bf3fd Adds null checks to test 2021-03-10 18:33:38 -05:00
spencergibb
587cc97b4c Adds ignore imports and profiles to ConfigData.
This allows config server to apply profiles and imports while ignoring them on the client side.

Fixes gh-1788
2021-03-10 17:55:20 -05:00
spencergibb
823d201701 fixes typo 2021-03-10 17:54:10 -05:00
spencergibb
2ea5e11c9a Fail if no configserver config import.
Adds ConfigServerConfigDataMissingEnvironmentPostProcessor that checks if there is a spring.config.import=configserver: statement. If not, an exception is thrown and a FailureAnalyzer provides hints to fix the issue.

Fixes gh-1813
2021-03-10 16:59:29 -05:00
spencergibb
a95f1300ad Ensures spring.cloud.config.name takes precedence.
spring.cloud.config.name should only default to spring.application.name, not be overridden by it.

Fixes gh-1784
2021-01-08 12:54:46 -05:00
spencergibb
ccb32d23fc Only use spring.cloud.config.profiles if not 'default'.
In ConfigData, the Profiles object takes care of resolving the default profile. So only prefer spring.cloud.config.profiles if it has been set to something other than 'default'.

Fixes gh-1777
2020-12-23 12:49:42 -05:00
spencergibb
f840725c12 Support Retry in spring.config.import=configserver:
Fixes gh-1775
2020-12-22 17:40:32 -05:00
Spencer Gibb
499739f308 Uses BindHandler if registered in bootstrap. (#1773)
* Uses BindHandler if registered in bootstrap.

This allows spring-cloud-context to register a TextEncryptorBindHandler and handle `{cipher}` prefixed properties prior to sending for remote data.

* Adds test that a BindHandler in bootstrap context is used.

* Makes KeyProperties a bean that is conditional on missing.
2020-12-20 11:39:11 -05:00