spring: + cloud: + config: + server: + git: + uri: https://github.com/spring-cloud-samples/config-repo + searchPaths: foo,bar*+
From 153684fc85582d4f79288daa05bffd4277bba021 Mon Sep 17 00:00:00 2001
From: Dave Syer
spring:
cloud:
config:
- server:
- git:
- uri: https://github.com/spring-cloud-samples/config-repo
- repos:
- simple: https://github.com/pattern1/config-repo
+ server:
+ git:
+ uri: https://github.com/spring-cloud-samples/config-repo
+ repos:
+ simple: https://github.com/pattern1/config-repo
special:
pattern: pattern*,*pattern1*
- uri: https://github.com/pattern2/config-repo
- local:
+ uri: https://github.com/pattern2/config-repo
+ local:
pattern: local*
- uri: file:/home/configsvc/config-repo
+ uri: file:/home/configsvc/config-repo
Every repository can also optionally store config files in
+sub-directories, and patterns to search for those directories can be
+specified as searchPaths. For example at the top level:
spring: + cloud: + config: + server: + git: + uri: https://github.com/spring-cloud-samples/config-repo + searchPaths: foo,bar*+
In this example the server searches for config files in the top level +and in the "foo/" sub-directory and also any sub-directory whose name +begins with "bar".
+To use HTTP basic authentication on the remote repository add the "username" and "password" properties separately (not in the URL), e.g.
@@ -1355,9 +1377,9 @@ e.g.spring:
cloud:
config:
- server:
- git:
- uri: https://github.com/spring-cloud-samples/config-repo
+ server:
+ git:
+ uri: https://github.com/spring-cloud-samples/config-repo
username: trolley
password: strongpassword
If you don’t use HTTPS and user credentials, SSH should also work out
of the box when you store keys in the default directories (~/.ssh)
-and the uri is points to an SSH location,
+and the uri points to an SSH location,
e.g. "git@github.com:configuration/cloud-configuration". The
repository is accessed using JGit, so any documentation you find on
that should be applicable.
Once you have an app that is @EnableEurekaClient you can use it to
-discover service instances from the Eureka Server. One way to do that is to use the native DiscoveryClient, e.g.
com.netflix.discovery.DiscoveryClient (as opposed to the Spring
+Cloud DiscoveryClient), e.g.
@Configuration
-@EnableAutoConfiguration
-@EnableHystrix
+@SpringBootApplication
+@EnableCircuitBreaker
public class Application {
public static void main(String[] args) {
@@ -2468,6 +2491,24 @@ public class TestConfiguration {
RibbonClientConfiguration together with any in FooConfiguration
(where the latter generally will override the former).
|
+ Warning
+ |
+
+The FooConfiguration has to be @Configuration but take
+care that it is not in a @ComponentScan for the main application
+context, otherwise it will be shared by all the @RibbonClients. If
+you use @ComponentScan (or @SpringBootApplication) you need to
+take steps to avoid it being included (for instance put it in a
+separate, non-overlapping package, or specify the packages to scan
+explicitly in the @ComponentScan).
+ |
+
Spring Cloud Netflix provides the following beans by default for ribbon
(BeanType beanName: ClassName):
The HTTP endpoints accept a "destination" parameter, e.g. "/bus/refresh?destination=customers:9000", where the destination is an ApplicationContext ID. If the ID is owned by an instance on the Bus then it will process the message and all other instances will ignore it. Spring Boot sets the ID for you in the ContextIdApplicationContextInitializer to a combination of the spring.application.name, active profiles and server.port by default.