anchor.diff:                                              null /* default config */);
   ----
   
  +== Spring Service Connector
  +
  +See <<spring-cloud-spring-service-connector.adoc#,Spring Cloud Spring Service Connector>>.
  +
  +== Cloud Foundry Connector
  +
  +See <<spring-cloud-cloud-foundry-connector.adoc#,Spring Cloud Cloud Foundry Connector>>.
  +
  +== Heroku Connector
  +
  +See <<spring-cloud-heroku-connector.adoc#,Spring Cloud Heroku Connector>>.
  +
  +== local-configuration Connector
  +
  +This connector provides the ability to configure Spring Cloud services locally for development or testing. **The current implementation reads from Java properties only.**
  +
  +=== Quick Start
  +
  +Since service URIs contain passwords and should not be stored in code, this connector does not attempt to read service definitions out of the classpath. You can provide service definitions as system properties.
  +
  +[source,term]
  +----
  +java -Dspring.cloud.database='mysql://user:pass@host:1234/dbname' -jar my-app.jar
  +----
  +
  +You can also provide service definitions from a configuration properties file, either by setting the `spring.cloud.propertiesFile` system property:
  +
  +[source,term]
  +----
  +java -Dspring.cloud.propertiesFile=/path/to/spring-cloud.properties -jar my-app.jar
  +----
  +
  +or by providing the bootstrap properties file `spring-cloud-bootstrap.properties` on the runtime classpath. This file will be inspected only for the property named `spring.cloud.propertiesFile`, and its value will be interpolated from the system properties.
  +
  +[source,properties]
  +----
  +spring.cloud.propertiesFile: ${user.home}/.config/myApp/spring-cloud.properties
  +----
  +
  +The system properties, or the configuration properties file, should contain an application ID and the desired services in the following format.
  +
  +[source,properties]
  +----
  +spring.cloud.appId:    myApp
  +; spring.cloud.{id}:   URI
  +spring.cloud.database: mysql://user:pass@host:1234/dbname
  +----
  +
  +The service type is determined by the URI scheme. The connector will activate if it finds a property (either in the system properties or in the configuration properties file) named `spring.cloud.appId`.
  +
  +=== Property Sources
  +
  +This connector first attempts to read the system properties generally and a system property named `spring.cloud.propertiesFile` specifically. If the system properties are not readable (if the security manager denies `checkPropertiesAccess`), then they will be treated as empty.  If a system property named `spring.cloud.propertiesFile` is found, then that file will be loaded as a property list.
  +
  +==== Providing a Bootstrap Properties File
  +
  +To avoid having to manually configure run configurations or test runners with the path to the configuration properties file, the connector can read a templated filename out of the runtime classpath. This file must be named `spring-cloud-bootstrap.properties` and be located at the classpath root. For security, the connector will not attempt to read any service URIs out of the file. If the connector does find the file, it will read the property `spring.cloud.propertiesFile` and link:http://commons.apache.org/proper/commons-lang/javadocs/api-release/index.html?org/apache/commons/lang3/text/StrSubstitutor.html[substitute the pattern `${system.property}`] with the appropriate value from the system properties. The most useful option is generally `${user.home}`.
  +
  +A configuration properties file specified in the system properties will override any bootstrap file that may be available on the classpath.
  +
  +==== Property Precedence
  +
  +To provide the maximum configuration flexibility, the connector will override any properties (both application ID and service definitions) specified in the file at `spring.cloud.propertiesFile` with system properties defined at runtime. The connector will log a message at `WARN` if you override a service ID.
  +
  +=== Activating the Connector
  +
  +Spring Cloud Core expects exactly one cloud connector to match the runtime environment.  This connector identifies the &#8220;local cloud&#8221; by the presence of a property, in a configuration properties file or in the system properties, named `spring.cloud.appId`. This property will be used in the `ApplicationInstanceInfo`.
  +
  +=== Service Definitions
  +
  +If the connector is activated, it will iterate through all of the available properties for keys matching the pattern `spring.cloud.{serviceId}`. Each value is interpreted as a URI to a service, and the type of service is determined from the scheme. Every standard `UriBasedServiceInfo` is supported.
  +
  +=== Instance ID
  +
  +This connector creates a UUID for use as the instance ID, as Java does not provide any portable mechanism for reliably determining hostnames or PIDs.
  +
  +== Extending Spring Cloud Connectors
  +
  +Besides the built-in service and cloud support and the included Spring Service Connector, Spring Cloud Connectors can be extended to support additional cloud platforms, cloud services, or application frameworks. See below for details.
  +
   === Adding Cloud Connectors
   
  -A cloud provider may extend Spring Cloud to make it work with a new cloud platform by adding a new `CloudConnector`. The connector is responsible for determining whether the application is running in the specific cloud, identifying application information (such as the name and instance ID of the particular running instance), and mapping bound services (such as URIs exposed in environment variables) as `ServiceInfo` objects.
  +To allow Spring Cloud to detect a new cloud platform, add a cloud connector for the platform. A cloud connector determines whether the application is running in the specific cloud, identifies application information (such as the name and instance ID of the particular running instance), and maps bound services (such as URIs exposed in environment variables) as `ServiceInfo` objects.
   
   [TIP]
   ====
  -See the <<_spring_cloud_cloud_foundry_connector,Cloud Foundry Connector>> and <<_spring_cloud_heroku_connector,Heroku Connector>> for examples.
  -====
  -
  -Spring Cloud uses the Java SPI to discover available connectors. New cloud connectors should list the fully-qualified class name in the provider-configuration file at `META-INF/services/org.springframework.cloud.CloudConnector`.
  -
  -=== Adding Service Discovery
  -
  -To allow Spring Cloud to discover a new type of service (e.g. a `HelloWorldService`), create a `ServiceInfo` class containing the information necessary to connect to the service. If your service can be specified via a URI, extend `UriBasedServiceInfo` and provide the URI scheme in a call to the `super` constructor.
  -
  -The following class will expose information for a service available at `helloworld://username:password@host:port/Bonjour`.
  +See the https://github.com/spring-cloud/spring-cloud-connectors/tree/master/spring-cloud-cloudfoundry-connector[Cloud Foundry Connector] and https://github.com/spring-cloud/spring-cloud-connectors/tree/master/spring-cloud-heroku-connector[Heroku Connector] for examples.
  +====
  +
  +Spring Cloud uses the https://docs.oracle.com/javase/tutorial/sound/SPI-intro.html[Java SPI] to discover available connectors. 
  +
  +To add new cloud connectors, your connector classes must implement the http://docs.spring.io/autorepo/docs/spring-cloud/current/api/index.html?org/springframework/cloud/CloudConnector.html[`CloudConnector`] interface. It includes three methods:
  +
  +* `boolean isInMatchingCloud()`: Determines whether the connector is operating in the cloud for which it provides support.
  ++
  +Spring Cloud Connectors will call `isInMatchingCloud()` on each cloud connector included in an application. The first connector to respond `true` will be activated.
  +* `ApplicationInstanceInfo getApplicationInstanceInfo()`: Returns information about the running application instance.
  ++
  +An `ApplicationInstanceInfo` must provide the instance id (`String`) and application id (`String`). Other properties can be added as needed to a `Map` and be returned via `getProperties()`.
  +* `List<ServiceInfo> getServiceInfos()`: Returns a `ServiceInfo` object for each service bound to the application.
  ++
  +`getServiceInfos()` can return an empty `List` if no services have been bound to the application.
  +
  +New cloud connectors should list the fully-qualified class name in the provider-configuration file at `META-INF/services/org.springframework.cloud.CloudConnector`.
  +
  +=== Adding Service Support
  +
  +To allow Spring Cloud to discover a new type of service, create a `ServiceInfo` class containing the information necessary to connect to the service. If your service can be specified via a URI, extend http://docs.spring.io/autorepo/docs/spring-cloud/current/api/org/springframework/cloud/service/UriBasedServiceInfo.html[`UriBasedServiceInfo`] and provide the URI scheme in a call to the `super` constructor.
  +
  +The following class will expose information for a `HelloWorldService` available at `helloworld://username:password@host:port/Bonjour`.
   
   [source,java]
   ----
  
positive.code: 
  [NOTE]
  ====
  If you are using Spring Cloud in a Spring application, you should consider <<_spring_cloud_spring_service_connector,automatically injecting Spring beans>> instead.
  ====
  
  * Include the desired cloud connectors on the runtime classpath, <<_getting_started,as described in the main documentation>>.
  
negative.code: Cloud cloud = cloudFactory.getCloud();
  ----
  +
  Note that you must have a `CloudConnector` suitable for your deployment environment on your classpath.  For example, if you are deploying the application to Cloud Foundry, you must add the <<_cloud_foundry_connector,Cloud Foundry Connector>> to your classpath. If no suitable `CloudConnector` is found, the `getCloud()` method will throw a `CloudException`.
  
  * Use the `Cloud` instance to access application and service information and to create service connectors.
  +
  