Commit Graph

78 Commits

Author SHA1 Message Date
Dave Syer
5802c0e2be Actually close parent context in RestartEndpoint
There could be consequences for apps that have more complex context
hierarchies, but RestartEndpoint doesn't work well at all for those
apps anyway, so we are probably safe to just make changes in the
endpoint itself.

Fixes gh-333
2018-03-08 11:55:49 +00:00
Spencer Gibb
f7695c7d15 Moves declaration of EnvironmentManager
fixes gh-314
2018-02-01 23:36:59 -05:00
Spencer Gibb
cd436c7d15 Avoid proxy error if bean implements ScopedObject
fixes gh-277
2018-02-01 19:09:11 -05:00
Spencer Gibb
fb76beb3f2 Test for NPE when calling getClass() in RefreshScope
fixes gh-297
2017-12-20 17:55:25 -05:00
Dave Syer
c5382ccfd6 Refactor ConfigurationPropertiesRebinder a bit
It's not super expensive, but it all adds up, and rebinding beans
that don't need to be rebound is wasteful. This change should improve
things in three places:

The ConfigurationPropertiesRebinder
has always done a pre-emptive re-bind on startup, which was a bit
of a blunt instrument, since all we really wanted as to rebind the
beans in the parent context (to the current context's Environment).

The rebinding always happened twice for every bean because we
explicitly called into the ConfigurationPropertiesPostProcessor
directly as well as indirectly through the initialization callbacks.

Rebinding in response to an EnvironmentChangeEvent was not able to
distinguish between events published locally and by child contexts.
The child context always binds the parent's beans anyway, so you
don't need to do it twice.
2017-12-15 15:58:17 +00:00
Spencer Gibb
259aa437d7 Allow refresh auto config to be disabled by property.
fixes gh-276
2017-11-28 19:57:54 -05:00
Spencer Gibb
1bd2c3112a Make sure cli args are copied to bootstrap. 2017-11-14 11:11:12 -05:00
Dave Syer
4352d9a81a Add test for profiles picked up from bootstrap.properties 2017-11-14 12:47:41 +00:00
Dave Syer
1b219b086c Tidy up compiler warnings 2017-11-07 17:06:16 +00:00
Dave Syer
93a0365422 Prevent logging system from being pinged on context refresh
A context refresh is actually only trying to recalculate environment
properties. Spring Boot doesn't provide an explicit API for that so
we create a "mini application" to mimic the startup. There is no
need for the logging system to be touched at all, so we can try
and filter out the listeners we know might do that.

Fixes gh-260
2017-11-07 10:32:23 +00:00
Dave Syer
91f60b3f4c Be more selective with the property sources in a context refresh
We need to tread a very fine line. Ideally the process of refreshing
the Environment builds it back exactly as happened on startup.
In particular we probably don't want to have things like
application.properties already there when we start the process.

This change replaces the more liberal copy of all property sources
only a select few (actually only one), paremeterized as a constant.
2017-11-03 14:01:29 +00:00
Spencer Gibb
707787dc13 Adds test for bootstrap context parent closing 2017-10-30 19:13:36 -04:00
Dave Syer
942df8ed45 Remove lombok from spring-cloud-context 2017-10-24 08:49:10 +01:00
Dave Syer
1add1067df Fix ordering of property sources on refresh
If there were *no* bootstrapProperties (i.e. properties added by
PropertySourceLocators) on startup, and then in a refresh event
some new sources were picked up, they would have been added to the
end, instead of the beginning of the list.

Fixes https://github.com/spring-cloud/spring-cloud-config/issues/815
2017-10-19 13:41:05 +01:00
Dave Syer
ccf613c29c Make method accessible in GenericScope proxy target
Otherwise app crashes on first access of scoped proxy.

Fixes gh-261
2017-10-11 08:12:32 -04:00
Dave Syer
c28ca5de91 Add extra concurrency test for refresh scope
The test passes (would have failed in parent commit)
because a lock is taken in the scoped proxy itself, not
in the target.
2017-10-04 14:14:45 +01:00
Biju Kunjummen
5aaafb19af Replaces deprecated o.s.b.a.PropertyPlaceholderAutoConfiguration 2017-08-21 20:35:45 -07:00
Biju Kunjummen
a6b7f70b8e Show better message for missing config keystore props (#232)
* Show better message for missing config keystore props

* Removes unused ExpectedException

Fixes #230
2017-08-04 15:53:35 -04:00
Johannes Edmeier
94a42737ec Fix empty keys in EnvironmentChangedEvent on resetting the Environment (#229)
When the Environment is resetted the EnvironmentChangedEvent always
contains an empty keySet, since the live view of the cleared map was
used. This commit fixes this.
2017-07-25 11:58:15 -04:00
Spencer Gibb
c75673110b formatting 2017-06-30 17:47:08 -06:00
Fabio Matos
2e81db24cf Disables endpoint creation (#208)
Fixes gh-117
2017-06-30 19:38:03 -04:00
Spencer Gibb
922608651a fix test path 2017-05-01 09:27:37 -06:00
Spencer Gibb
b40ceef356 RefreshEventListener no longer depends on RefreshEndpoint.
Instead it depends on ContextRefresher with actually does the work.

This allows applications to use the listener even if they don't depend
on actuator.

fixes gh-171
2017-04-03 20:13:11 -06:00
Spencer Gibb
78d10fc223 Use relaxed property resolver in KeyCondition
Allows users to define properties like encrypt.key-store.password=letmein

fixes gh-191

(cherry picked from commit 7744b63)
2017-04-03 19:52:17 -06:00
Spencer Gibb
1eddbc125b fix compile errors in tests 2017-03-15 12:08:04 -06:00
Dave Syer
45b0c078eb Merge branch '1.1.x' 2017-03-15 12:18:14 +00:00
Dave Syer
ba281228f6 Apply bootstrap initializers to all contexts in a hierarchy
The fix for gh-153 was sensible, but has now exposed another issue
which is that the bootstrap initializers, whilst they are now only
created once, actually only get applied to the parent context
in a hierarchy.

Most of the time this doesn't matter because the child contexts all
benefit from environment changes and additional beans added
to the parent. If the children are supposed to actually have
different environments, though, there is a problem. So this change
locates the existing bootstrap context and applies it to each
new context created separately.

Unfortunately we have to use reflection to do that for now because
there is no way to discover the parent with a public API before
the context is refreshed.

See gh-190
2017-03-15 12:16:32 +00:00
Dave Syer
70d601df84 Register a BeanDefinition manually instead of using @Bean
For RefreshScope this stops Spring from moaning about the @Bean
method with a WARN log (which is benign but hard to get rid of
and confusing for users).

See gh-401
2017-03-15 12:15:51 +00:00
Spencer Gibb
1865bc6306 polish 2017-03-01 10:43:01 -07:00
Biju Kunjummen
4e0d2e520f Fixes possible infinite loop
Fixes edge case of an infinite loop in decrypting properties in a hierarchy of application contexts.


fixes gh-178
2017-03-01 12:41:00 -05:00
Dave Syer
d2ab1c6de9 Merge branch '1.1.x' 2017-02-24 09:42:36 +00:00
Dave Syer
331e790026 Ensure there is a single bootstrap parent context
Only one neds to be created, and once it is in place in the hierarchy
it should be usable by all the child contexts that get added.

Fixes gh-153
2017-02-24 09:38:30 +00:00
Spencer Gibb
dcaef01b27 Update to boot 1.5 test classes 2017-02-21 08:19:24 -07:00
Dave Syer
d5a63c988d Merge branch '1.1.x' 2017-02-21 10:18:29 +00:00
Dave Syer
8347c5741c Extract target from @ConfigurationProperties proxy
Fixes gh-175 (more of a workaround really and gh-177 is still open
to track further changes).
2017-02-21 10:01:05 +00:00
Spencer Gibb
a86356327c fix tests for boot 1.4.x 2017-02-14 14:23:27 -07:00
Spencer Gibb
5b8ae3a96a Make sure bootstrap sources are ordered before use.
Make call to sort() before setting on builder.sources().

fixes gh-176

(cherry picked from commit 6dc35d1)
2017-02-14 14:18:48 -07:00
Spencer Gibb
6dc35d1edc Make sure bootstrap sources are ordered before use.
Make call to sort() before setting on builder.sources().

fixes gh-176
2017-02-14 14:17:11 -07:00
Matt Benson
941275ded2 consider spring.profiles.include values from bootstrap PropertySources (#123) 2017-01-26 12:14:43 -05:00
Spencer Gibb
210c7b9017 Update spring-cloud-build to 1.3.1.BUILD-SNAPSHOT 2017-01-09 18:25:48 -07:00
Matthew Reid
63e4e3b8d6 Allow lifecycle endpoints to be globally disabled using endpoints.enabled property (#148)
fixes gh-158
2017-01-09 14:37:48 -05:00
Anders Båtstrand
69192f6f67 Exposing context names, fixes https://github.com/spring-cloud/spring-cloud-netflix/issues/1585. 2017-01-04 11:00:51 +01:00
Spencer Gibb
e13764db66 Fixes indexed properties merging problem.
Given the following in one property source
```
mine[0].someValue=Foo
mine[0].someKey={cipher}XXXX
mine[1].someValue=Bar
mine[1].someKey={cipher}XXXX
yours[0].anotherKey=Baz
```
only `mine[*].someKey` were added to "decrypted" property source. Due to house spring boot manages indexed properties, they can not be merged across property source. This change includes all indexed properties in the "decrypted" property source if any one of them is encrypted.

In the above example, `yours[*].*` is included even though unrelated.

fixes gh-466
2016-09-09 14:23:19 -06:00
Dave Syer
31a2b3ea0e Make some tests more robust so they pass with BOot 1.4 as well
A couple of tests here make assumptions about the property source
names added using @IntegrationTest. If we are a bit more defensive
and search for a source with a matching name instead of grabbing
one by the precise name, we can have tests that pass in Boot 1.3
and 1.4.
2016-05-05 14:05:46 +01:00
Dave Syer
b54c8e80e8 Add support for endpoints.env.post.enabled=false
Separately disable the POST /env from the GET. Fixes gh-106.
2016-04-18 10:04:56 +01:00
Venil Noronha
b92016b260 Moved RefreshEndpoint logic to ContextRefresher.
Fixes gh-101
2016-04-01 15:03:30 -06:00
Dave Syer
7eccbc4bac Make LoggingRebinder case insensitive
Partly to account for the fact that Sprng Boot publishes config
meta data with lower case values (don't ask).
2016-03-04 09:22:03 +00:00
Dave Syer
1c430d4ff3 Add test for serialization ID in RefreshScope
It should be unique and deterministic by default.
2016-02-29 13:57:37 +00:00
Spencer Gibb
86ff712398 Properly close child contexts in destroy()
fixes gh-91
2016-02-22 10:49:54 -07:00
Dave Syer
624be9d19e Fix ordering of property sources
When the bootstrap properties are added back into the main Environment
we have to be careful that any source that is already there (such as
one that was added in a Spring Boot EnvironmentPostProcessor) is not
replaced in the wrong order.

Fixes gh-90
2016-02-15 10:25:19 +00:00