Commit Graph

212 Commits

Author SHA1 Message Date
Dave Syer
07b4ceaa2a Fix mvnw script for milestones 2016-03-02 17:34:24 +00:00
Spencer Gibb
4a2c754ec6 Move o.s.c.util to o.s.c.commons.util
fixes gh-92
2016-03-02 09:22:03 -07:00
Spencer Gibb
779e5686a9 Add ability to disable parts of commons auto config.
fixes gh-95
2016-03-01 13:35:22 -07:00
Marcin Grzejszczak
760b0ef42c Merge pull request #94 from spring-cloud/pick_predefined_port
Pick predefined port if it's set
2016-03-01 06:58:28 +01:00
Marcin Grzejszczak
c7fc6552c0 Pick predefined port if it's set 2016-02-29 17:27:48 +01: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
Dave Syer
099953f795 Use system environment property source 2016-02-25 11:52:34 +00:00
Spencer Gibb
539a537abb Expose some information.
See https://github.com/spring-cloud/spring-cloud-netflix/issues/643
2016-02-22 16:54:51 -07: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
Dave Syer
8628949a8d Set -Pmilestone automatically based on pom version 2016-02-12 17:45:17 +00:00
Dave Syer
df7fe24a0e Make grep quiet when setting env vars 2016-02-12 15:48:42 +00:00
Dave Syer
858c144e10 Fix logic with MVN_GOAL 2016-02-12 15:06:20 +00:00
Dave Syer
3d76fd33a5 Align travis build with tools in spring-cloud/build 2016-02-12 13:17:08 +00:00
tc
bcb4e60448 Fix property source for decrypted variables
Use SystemEnvironmentPropertySource so that env vars can be
encrypted as well as property values (i.e. FOO_BAR will bind to
@Value("foo.bar")).

Fixes gh-89, fixes gh-87
2016-02-11 14:46:26 +00:00
Spencer Gibb
42b21d8399 Move RefreshEvent and Listener from consul/zk 2016-02-08 17:04:41 -07:00
Dave Syer
fc44a48194 Revert to snapshots 2016-02-04 18:01:59 +00:00
Dave Syer
fc895ca514 Update to 1.0.0.M5 2016-02-04 18:01:59 +00:00
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
Spencer Gibb
9500052273 Generate readme for code of conduct.
See https://github.com/spring-cloud/spring-cloud-build/issues/26
2016-02-01 20:09:54 -07:00
Dave Syer
5cfe42b9af Fix careless mistake in tests 2016-02-01 13:26:21 +00:00
Dave Syer
7665f48653 Return address from the interface with lowest index
Also fixes unclosed closeable warnings

Fixes gh-82
2016-01-31 16:38:10 +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
2112bb23ec Ensure metadata is writable by default 2016-01-25 10:00:40 +00:00
Dave Syer
b07c1a0351 Remove unecessary throws from close() 2016-01-25 10:00:12 +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
820b82f65f Fix tests (port clash) 2016-01-22 11:11:35 +00:00
Spencer Gibb
142c9ab5b5 removed unneeded attribute per @dsyer 2016-01-20 16:28:35 -07:00
Spencer Gibb
40e048c820 Make sure InetUtils.executorService shuts down.
See https://github.com/spring-cloud/spring-cloud-netflix/issues/491
2016-01-19 14:33:28 -07:00
Dave Syer
df6203a204 Fix ordering problem with tests
EnableDiscoveryClientMissingImplTests did not close its application
context, so it caused other tests to fail on the command line
(sometimes).
2016-01-18 18:05:26 +00:00
Dave Syer
47c77cb165 Fix discovery client if enabled but no impl available
If user has @EnableDiscoveryClient but no implementation (e.g. if he
just has @EnableZuulProxy) the autoconfig will now kick in and
provide an instance of NoopDiscoveryClient.

Fixes gh-80
2016-01-18 18:04:06 +00:00
Spencer Gibb
457d237ad0 Merge pull request #76 from olivergierke/hypermedia
Added hypermedia support in the form of a DiscoveredResource abstraction
2016-01-13 15:05:53 -07:00
Oliver Gierke
526b338c36 Added hypermedia support in the form of a RemoteResource abstraction.
This commit introduces support to easily discover resources in remote
service APIs and periodically validating they're still available.

The core concept is a RemoteResource and its primary implementation
DiscoveredResource which consists of a ServiceInstanceProvider and a
TraversalDescription. The service instance provider abstracts the location
of the service the DiscoveredResource is hosted at. Currently there are
two implementations available: a StaticServiceInstanceProvider that — as
the name suggests — returns a statically configured instance, as well as
the DynamicServiceInstanceProvider which takes a DiscoveryClient and service
name as input to dynamically discover the ServiceInstance on request.

The TraversalDefinition is a SAM type that allows to define the path traversals
that shall be executed to discover the target resource within the service
instance. This allows the following configuration:

DiscoveryClient client = …
ServiceInstanceProvider provider = new DynamicServiceInstanceProvider(client, "stores");
RemoteResource resource = new DiscoveredResource(provider, traverson -> traverson.follow("stores", "search", "by-location");

This will cause the following to happen:

1. In this default state the resource is undiscovered and calls to getLink()
   will return null.
2. A call to verifyOrDiscover() will trigger resource discovery, i.e. lookup
   the service instance using the discovery client, execute the path traversal
   as defined and store the final link discovered ("by-location") in the
   discovered resource.
3. Calls to getLink() will return that link. Calls to verifyOrDiscover()
   will issue a HEAD request to verify the resource is still available and
   reset the link if not. Subsequent calls to verifyOrDiscover() will trigger
   rediscovery.

That means that we basically shield against either the service instance becoming
unavailable or the resource becoming unavailable within the service instance
(due to some URI restructuring or the like).

The calls to verifyOrDiscover() are currently automated by a RemoteResourceRefresher
which is auto-configured if a RemoteResource is declared as Spring bean
and its initial and fixed delay can be configured via properties in the
spring.cloud.hypermedia namespace.
2016-01-13 19:58:33 +01:00
Dave Syer
cbfd48d5fa Make thread pool static and provide convenience wrappers
Existing usages of the static methods should still work, and all
usage is on a single background thread.

Fixes gh-77
2016-01-12 16:23:43 +00:00
Dave Syer
168bd6c77d Add spring profiles for repos 2016-01-08 13:15:04 +00:00
Dave Syer
a44f9b72bb Remove duplicate repo declarations 2016-01-08 12:26:50 +00:00
Dave Syer
55bdda9cb1 Don't clobber rest template interceptors 2016-01-08 12:05:45 +00:00
Dave Syer
cd7fbd617d Add separate dependencies module 2016-01-08 12:05:13 +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
162fb70349 Change log level to trace in InetUtils 2015-12-31 10:52:21 +00:00
Dave Syer
26871830f5 Add some docs for config properties 2015-12-30 15:06:07 +00:00
Spencer Gibb
8983309b48 Fix bonehead mistake.
That'll show me for trying to code right before the holidays.

Not only was the auto-config in the WRONG package, I forgot to enable it in autoconfiguration!

fixes gh-bonehead
2015-12-22 17:51:25 -07:00
Spencer Gibb
0d35d3f322 Document ignoring network interfaces. 2015-12-22 17:10:09 -07:00
Spencer Gibb
a42e8eaab5 Allow configurable ignoring of network interfaces.
fixes gh-67
2015-12-22 17:01:52 -07:00
Spencer Gibb
aa2ddce31e Merge pull request #56 from jmnarloch/discovery-metadata
* discovery-metadata:
  Introduced ServiceInstance metadata map.
2015-12-22 14:44:27 -07:00