Commit Graph

60 Commits

Author SHA1 Message Date
Spencer Gibb
8a21f71ad1 Reuse pause and resume endpoints to the can be disabled.
fixes gh-86
2016-02-03 12:38:28 -07:00
Dave Syer
9c6aeba780 Ensure spring.main.sources is not used in refresh cycle
When the RefreshEndpoint makes a new Environment it creates a new
ApplicationContext with (hopefully) empty sources. If the user has
set spring.main.sources it won't be empty, so we should take care
to mask it off in the process.

Fixes gh-79
2016-02-02 21:55:19 +00:00
Dave Syer
6f463ad10d Add RefreshScopeHealthIndicator
Repots DOWN if there are errors in RefreshScope or
ConfigurationProperties rebinding, N.B. RefreshScope instantiates
its beans lazily after a refresh by default, so you won't see an
error until the bean is used.

Fixes gh-85
2016-02-02 17:28:52 +00:00
Dave Syer
5cfe42b9af Fix careless mistake in tests 2016-02-01 13:26:21 +00:00
Dave Syer
fb37883a92 Ensure BootstrapApplicationListener adds property sources on refresh
The fact that PropertySourceBootstrapConfiguration was re-using the
"bootstrap" property source name from the listener was a problem. The
listener has to be able to manage its own temporary property source name.

Fixes gh-83
2016-01-30 10:20:49 +00:00
Dave Syer
f550de7559 Only eagerly initialize refresh scope beans that are not lazy 2016-01-29 13:11:44 +00:00
Dave Syer
12b9bfbe12 Extract file-based property sources during bootstrap
The bootstrap.properties need to stick with the default properties
during the process of initializing the application.properties
otherwise the ordering ends up wrong because of the addLast()
semantics in an Environment merge. To do this is a bit ugly with
the additional constraint that the default properties has to
remain a MapPropertySource (so that other processors can append
to it if needed). So we created a custom extension of
MapPropertySource that also carries all the bootstrap properties
during the phase where the application.properties are being
processed, but unpacks them as soon as possible afterwards
in an ApplicationContextInitializer, preserving the order, but
making the bootstrap.properties available effectively for the
whole of the startup and initializaion phase of the main context.
2016-01-23 10:37:20 +00:00
Dave Syer
b4c2c14d68 Further paring down of leaky proeprty sources in Bootstrap phase
The biggest problem addressed here is one where an
EnvironmentPostProcessor (reasonably) adds entries to the
defaultProperties in the bootstrap context, but then that
property source is not merged with the parent, or is merged
too late (because it only happens when the application context
parent is set). The result would be that things that were activated
during bootstrap would be not be activated in the main context, or
would be activated too late (early enough for beans to bind to but
not for other listeners and post processors to get access to the
additional properties).

See https://github.com/spring-cloud/spring-cloud-sleuth/issues/126
2016-01-22 14:26:54 +00:00
Dave Syer
532cb8efc7 Simplify logic with boot strap property sources a bit
We only need one special name for a property source. In the end it
gets used twice, but this simplifies the logic a bit and ensures that
there is never a PropertySource with that name and things like
spring.application.name=bootstrap in it.
2016-01-22 12:27:56 +00:00
Dave Syer
14d54b1964 Eagerly instantiate @RefreshScope beans on startup
This ensures that any fetaures that require a bean to be instantiated
(for instance @Scheduled) behave the same for @RefreshScope and normal
singletons.

Fixes gh-74
2015-12-31 15:30:30 +00:00
Dave Syer
aaa7288bae Synchronize access to the ObjectFactory in GenericScope
Otherwise multiple instances of a scoped target can be created
if several threads need one at the same time. This isn't always
going to be a problem, but it breaks the singleton semantics, and
might lead to surprising results and/or performance issues if bean
creation is expensive.
2015-12-21 15:45:31 +00:00
Dave Syer
79b11df61f Take care with order of property sources in /refresh endpoint
It's kind of a corner case, but not a very small corner: if a /refresh
leads to a change in a key that was overridden from its default value (e.g.
n a profile-specific config file) then the key is not identified as changed.
The change is still applied.

This commit fixes the key computation and adds a couple of tests.

Fixes gh-73
2015-12-21 14:32:33 +00:00
Dave Syer
18b29ba35b Revert to snapshot 2015-12-18 15:52:36 +00:00
Dave Syer
cb25fa2166 Update to 1.1.0.M4 2015-12-18 15:50:30 +00:00
Dave Syer
016224287f Re-order autoconfig: refresh scope can be used without actuator 2015-12-18 14:59:47 +00:00
Dave Syer
5e29312518 Reverse order of property sources before decrypting
Fixes gh-70
2015-12-18 10:04:27 +00:00
Spencer Gibb
7d86198b17 Migrate SpringClientFactory and FeignClientFactory functions
fixes gh-69
2015-12-17 14:25:15 -07:00
Dave Syer
c2b473adb0 Reverts 5d7f18f so that shutdown hook is owned by main context
Fixes gh-62, fixes gh-63
2015-12-04 14:11:47 +00:00
Dave Syer
96ec2d32ea Switch of shutdown hook in bootstrap
Fixes gh-61
2015-12-02 17:07:26 +00:00
Dave Syer
fcc1249827 Ensure info endpoint is available when condition is evaluated 2015-11-17 11:58:56 +00:00
Dave Syer
346e513bcb Revert to snapshots 2015-11-17 09:52:52 +00:00
Dave Syer
a0e95019f0 Update to 1.1.0.M3 2015-11-17 09:47:41 +00:00
Dave Syer
988189db82 Add extra decryption step before propery source locators
See also the integration tests in spring-cloud-samples/tests

Fixes gh-58
2015-11-11 09:13:56 +00:00
Dave Syer
a6124e7063 Add another property source for decrypted bootstrap properties
The problem is that we do want bootstrap properties to override
default properties in most cases, but if they are decrypted those
values have to be added with the highest possible precedence.

Fixes gh-54
2015-10-02 15:00:22 +01:00
Dave Syer
bf8c7cff71 Add test for refresh scope behaviour 2015-09-24 13:56:42 +01:00
Dave Syer
8c346506f4 Re-order events in RefreshEndpoint
EnvironmentChangeEvent should come before the RefreshScopeRefreshedEvent
so that all the @ConfigurationProperties are fully bound when the refresh
happens.
2015-09-24 12:14:46 +01:00
Dave Syer
efbcbfa22e Send EnvironmentChangeEvent even if no keys changed 2015-09-23 16:50:16 +01:00
Dave Syer
51983c376c Revert to snapshot 2015-09-08 10:21:35 +01:00
Dave Syer
8093134713 Update for M1 release 2015-09-08 10:12:42 +01:00
Dave Syer
70e3588fd8 Re-initialize logging if anything shows up in logging.* 2015-09-07 09:46:09 +01:00
Dave Syer
6a5dedd498 Re-initialize logging if the logfile changes
Fixes gh-224
2015-09-05 10:03:14 +01:00
Spencer Gibb
41cfa132d2 fix possible NPE
fixes gh-51
2015-08-28 15:27:21 -06:00
Dave Syer
dc06921877 Add test for message source configuration
See gh-29
2015-08-21 17:19:03 +01:00
Dave Syer
f022fb78bd Move RefreshEndpoint to more logical package 2015-08-21 14:40:52 +01:00
Dave Syer
b022a39ba8 Rebind configuration properties on startup in case environment changed
The main driver for this was a config server use case, where the server
wants to configure its own properties in the remote repo. It was working
up to a point, but the beans in bootstrap context were not refreshed
after the Environment was built so you had to manually refresh them to
get them to point to (e.g.) config repos configured remotely.

Fixes https://github.com/spring-cloud/spring-cloud-config/issues/139
2015-08-21 12:32:19 +01:00
Glenn Renfro
e4bacc1353 isRefreshScoped returns false if beanName is null
Refer to notes in https://github.com/spring-cloud/spring-cloud-commons/issues/49 for details
2015-08-20 11:28:08 -04:00
Dave Syer
addeda8262 Allow ConfigurationPropertiesRebinder to rebind beans by name
including ones in the parent context.
2015-07-28 13:07:37 +01:00
Dave Syer
4df29bdfe7 Suppress rebinding of configuration properties for refresh scope
If a @ConfigurationProperties @Bean is in @RefreshScope then it doesn't
need to be rebound on an environment change event (it will re-initialize
on refresh).

See https://github.com/spring-cloud/spring-cloud-config/issues/183
2015-07-20 17:05:34 +01:00
Dave Syer
fbe17efd30 Internal change in RefreshEndpoint to keep property sources separate
The incoming (existing) environment needs to be used to initalize the
context that is created to grab the new environment, but we shouldn't
re-use the existing environment, rather just copy the property sources
and profiles.
2015-07-14 13:24:01 +01:00
Dave Syer
a58d06a704 Add test for refresh scope on configuration properties list 2015-07-14 13:24:01 +01:00
Dave Syer
a1628915ff Merge branch '1.0.x' 2015-07-06 12:37:36 +01:00
Dave Syer
ac6b833a97 Use bean post processor to rebind info endpoint
Fixes gh-25
2015-07-06 12:36:41 +01:00
Dave Syer
c55c6117ab Update to Spring Boot 1.3, stage I (make it compile) 2015-07-03 09:54:14 +01:00
Dave Syer
8a8baee253 Update to Brixton 2015-06-26 12:57:05 +01:00
Dave Syer
3e0bf055fe Prepare master for next snapshot 2015-06-26 10:57:17 +01:00
Dave Syer
e737c1e886 Check classpath before instantiating RSA 2015-06-24 21:03:27 +01:00
Dave Syer
cde7c7f311 Bump spring-security-rsa 2015-06-24 17:21:11 +01:00
Dave Syer
5d7f18f91f Ensure there is only one shutdown hook
The effect of not doing this is not often noticeable, but you sometimes
get a race condition between a context and its parent closing in different
threads without it.
2015-06-04 09:09:32 +01:00
Dave Syer
6d4248bbcd Respect encrypt.failFast on client 2015-06-02 15:26:30 +01:00
Spencer Gibb
9bb0caa985 removed duplicate license 2015-05-22 09:00:16 -06:00