Spring Cloud


Table of Contents

1. Features
I. Cloud Native Applications
2. Spring Cloud Context: Application Context Services
2.1. The Bootstrap Application Context
2.2. Application Context Hierarchies
2.3. Changing the Location of Bootstrap Properties
2.4. Overriding the Values of Remote Properties
2.5. Customizing the Bootstrap Configuration
2.6. Customizing the Bootstrap Property Sources
2.7. Environment Changes
2.8. Refresh Scope
2.9. Encryption and Decryption
2.10. Endpoints
3. Spring Cloud Commons: Common Abstractions
3.1. @EnableDiscoveryClient
3.2. ServiceRegistry
3.2.1. ServiceRegistry Auto-Registration
3.2.2. Service Registry Actuator Endpoint
3.3. Spring RestTemplate as a Load Balancer Client
3.3.1. Retrying Failed Requests
3.4. Multiple RestTemplate objects
3.5. Ignore Network Interfaces
II. Spring Cloud Config
4. Quick Start
4.1. Client Side Usage
5. Spring Cloud Config Server
5.1. Environment Repository
5.1.1. Git Backend
Placeholders in Git URI
Pattern Matching and Multiple Repositories
Authentication
Authentication with AWS CodeCommit
Git SSH configuration using properties
Placeholders in Git Search Paths
Force pull in Git Repositories
5.1.2. Version Control Backend Filesystem Use
5.1.3. File System Backend
5.1.4. Vault Backend
Multiple Properties Sources
5.1.5. Sharing Configuration With All Applications
File Based Repositories
Vault Server
5.1.6. Composite Environment Repositories
Custom Composite Environment Repositories
5.1.7. Property Overrides
5.2. Health Indicator
5.3. Security
5.4. Encryption and Decryption
5.5. Key Management
5.6. Creating a Key Store for Testing
5.7. Using Multiple Keys and Key Rotation
5.8. Serving Encrypted Properties
6. Serving Alternative Formats
7. Serving Plain Text
8. Embedding the Config Server
9. Push Notifications and Spring Cloud Bus
10. Spring Cloud Config Client
10.1. Config First Bootstrap
10.2. Discovery First Bootstrap
10.3. Config Client Fail Fast
10.4. Config Client Retry
10.5. Locating Remote Configuration Resources
10.6. Security
10.6.1. Health Indicator
10.6.2. Providing A Custom RestTemplate
10.6.3. Vault
10.7. Vault
10.7.1. Nested Keys In Vault
III. Spring Cloud Netflix
11. Service Discovery: Eureka Clients
11.1. How to Include Eureka Client
11.2. Registering with Eureka
11.3. Authenticating with the Eureka Server
11.4. Status Page and Health Indicator
11.5. Registering a Secure Application
11.6. Eureka’s Health Checks
11.7. Eureka Metadata for Instances and Clients
11.7.1. Using Eureka on Cloudfoundry
11.7.2. Using Eureka on AWS
11.7.3. Changing the Eureka Instance ID
11.8. Using the EurekaClient
11.9. Alternatives to the native Netflix EurekaClient
11.10. Why is it so Slow to Register a Service?
11.11. Zones
12. Service Discovery: Eureka Server
12.1. How to Include Eureka Server
12.2. How to Run a Eureka Server
12.3. High Availability, Zones and Regions
12.4. Standalone Mode
12.5. Peer Awareness
12.6. Prefer IP Address
13. Circuit Breaker: Hystrix Clients
13.1. How to Include Hystrix
13.2. Propagating the Security Context or using Spring Scopes
13.3. Health Indicator
13.4. Hystrix Metrics Stream
14. Circuit Breaker: Hystrix Dashboard
15. Hystrix Timeouts And Ribbon Clients
15.1. How to Include Hystrix Dashboard
15.2. Turbine
15.3. Turbine Stream
16. Client Side Load Balancer: Ribbon
16.1. How to Include Ribbon
16.2. Customizing the Ribbon Client
16.3. Customizing the Ribbon Client using properties
16.4. Using Ribbon with Eureka
16.5. Example: How to Use Ribbon Without Eureka
16.6. Example: Disable Eureka use in Ribbon
16.7. Using the Ribbon API Directly
16.8. Caching of Ribbon Configuration
17. Declarative REST Client: Feign
17.1. How to Include Feign
17.2. Overriding Feign Defaults
17.3. Creating Feign Clients Manually
17.4. Feign Hystrix Support
17.5. Feign Hystrix Fallbacks
17.6. Feign and @Primary
17.7. Feign Inheritance Support
17.8. Feign request/response compression
17.9. Feign logging
18. External Configuration: Archaius
19. Router and Filter: Zuul
19.1. How to Include Zuul
19.2. Embedded Zuul Reverse Proxy
19.3. Zuul Http Client
19.4. Cookies and Sensitive Headers
19.5. Ignored Headers
19.6. The Routes Endpoint
19.7. Strangulation Patterns and Local Forwards
19.8. Uploading Files through Zuul
19.9. Query String Encoding
19.10. Plain Embedded Zuul
19.11. Disable Zuul Filters
19.12. Providing Hystrix Fallbacks For Routes
19.13. Zuul Developer Guide
19.13.1. The Zuul Servlet
19.13.2. Zuul RequestContext
19.13.3. @EnableZuulProxy vs. @EnableZuulServer
19.13.4. @EnableZuulServer Filters
19.13.5. @EnableZuulProxy Filters
19.13.6. Custom Zuul Filter examples
19.13.7. How to Write a Pre Filter
19.13.8. How to Write a Route Filter
19.13.9. How to Write a Post Filter
19.13.10. How Zuul Errors Work
19.13.11. Zuul Eager Application Context Loading
20. Polyglot support with Sidecar
21. RxJava with Spring MVC
22. Metrics: Spectator, Servo, and Atlas
22.1. Dimensional vs. Hierarchical Metrics
22.2. Default Metrics Collection
22.3. Metrics Collection: Spectator
22.3.1. Spectator Counter
22.3.2. Spectator Timer
22.3.3. Spectator Gauge
22.3.4. Spectator Distribution Summaries
22.4. Metrics Collection: Servo
22.4.1. Creating Servo Monitors
22.5. Metrics Backend: Atlas
22.5.1. Global tags
22.5.2. Using Atlas
22.6. Retrying Failed Requests
22.6.1. Configuration
22.6.2. Zuul
IV. Spring Cloud Stream
23. Introducing Spring Cloud Stream
24. Main Concepts
24.1. Application Model
24.1.1. Fat JAR
24.2. The Binder Abstraction
24.3. Persistent Publish-Subscribe Support
24.4. Consumer Groups
24.4.1. Durability
24.5. Partitioning Support
25. Programming Model
25.1. Declaring and Binding Channels
25.1.1. Triggering Binding Via @EnableBinding
25.1.2. @Input and @Output
Customizing Channel Names
Source, Sink, and Processor
25.1.3. Accessing Bound Channels
Injecting the Bound Interfaces
Injecting Channels Directly
25.1.4. Producing and Consuming Messages
Native Spring Integration Support
Spring Integration Error Channel Support
Using @StreamListener for Automatic Content Type Handling
Using @StreamListener for dispatching messages to multiple methods
25.1.5. Reactive Programming Support
Reactor-based handlers
RxJava 1.x support
25.1.6. Aggregation
Configuring aggregate application
Configuring binding service properties for non self contained aggregate application
26. Binders
26.1. Producers and Consumers
26.2. Binder SPI
26.3. Binder Detection
26.3.1. Classpath Detection
26.4. Multiple Binders on the Classpath
26.5. Connecting to Multiple Systems
26.6. Binder configuration properties
27. Configuration Options
27.1. Spring Cloud Stream Properties
27.2. Binding Properties
27.2.1. Properties for Use of Spring Cloud Stream
27.2.2. Consumer properties
27.2.3. Producer Properties
27.3. Using dynamically bound destinations
28. Content Type and Transformation
28.1. MIME types
28.2. MIME types and Java types
28.3. Customizing message conversion
28.4. @StreamListener and Message Conversion
29. Schema evolution support
29.1. Apache Avro Message Converters
29.2. Converters with schema support
29.3. Schema Registry Support
29.4. Schema Registry Server
29.4.1. Schema Registry Server API
POST /
GET /{subject}/{format}/{version}
GET /{subject}/{format}
GET /schemas/{id}
DELETE /{subject}/{format}/{version}
DELETE /schemas/{id}
DELETE /{subject}
29.5. Schema Registry Client
29.5.1. Schema Registry Client properties
29.6. Avro Schema Registry Client Message Converters
29.6.1. Avro Schema Registry Message Converter properties
29.7. Schema Registration and Resolution
29.7.1. Schema Registration Process (Serialization)
29.7.2. Schema Resolution Process (Deserialization)
30. Inter-Application Communication
30.1. Connecting Multiple Application Instances
30.2. Instance Index and Instance Count
30.3. Partitioning
30.3.1. Configuring Output Bindings for Partitioning
Spring-managed custom PartitionKeyExtractorClass implementations
Configuring Input Bindings for Partitioning
31. Testing
32. Health Indicator
33. Metrics Emitter
34. Samples
35. Getting Started
V. Binder Implementations
36. Apache Kafka Binder
36.1. Usage
36.2. Apache Kafka Binder Overview
36.3. Configuration Options
36.3.1. Kafka Binder Properties
36.3.2. Kafka Consumer Properties
36.3.3. Kafka Producer Properties
36.3.4. Usage examples
Example: Setting autoCommitOffset false and relying on manual acking.
Example: security configuration
Using the binder with Apache Kafka 0.10
Excluding Kafka broker jar from the classpath of the binder based application
36.4. Dead-Letter Topic Processing
37. RabbitMQ Binder
37.1. Usage
37.2. RabbitMQ Binder Overview
37.3. Configuration Options
37.3.1. RabbitMQ Binder Properties
37.3.2. RabbitMQ Consumer Properties
37.3.3. Rabbit Producer Properties
37.4. Retry With the RabbitMQ Binder
37.4.1. Overview
37.4.2. Putting it All Together
37.5. Dead-Letter Queue Processing
37.5.1. Non-Partitioned Destinations
37.5.2. Partitioned Destinations
republishToDlq=false
republishToDlq=true
VI. Spring Cloud Bus
38. Quick Start
39. Addressing an Instance
40. Addressing all instances of a service
41. Application Context ID must be unique
42. Customizing the Message Broker
43. Tracing Bus Events
44. Broadcasting Your Own Events
44.1. Registering events in custom packages
VII. Spring Cloud Sleuth
45. Introduction
45.1. Terminology
45.2. Purpose
45.2.1. Distributed tracing with Zipkin
45.2.2. Visualizing errors
45.2.3. Live examples
45.2.4. Log correlation
JSON Logback with Logstash
45.2.5. Propagating Span Context
Baggage vs. Span Tags
45.3. Adding to the project
45.3.1. Only Sleuth (log correlation)
45.3.2. Sleuth with Zipkin via HTTP
45.3.3. Sleuth with Zipkin via Spring Cloud Stream
45.3.4. Spring Cloud Sleuth Stream Zipkin Collector
46. Additional resources
47. Features
48. Sampling
49. Instrumentation
50. Span lifecycle
50.1. Creating and closing spans
50.2. Continuing spans
50.3. Creating spans with an explicit parent
51. Naming spans
51.1. @SpanName annotation
51.2. toString() method
52. Managing spans with annotations
52.1. Rationale
52.2. Creating new spans
52.3. Continuing spans
52.4. More advanced tag setting
52.4.1. Custom extractor
52.4.2. Resolving expressions for value
52.4.3. Using toString method
53. Customizations
53.1. Spring Integration
53.2. HTTP
53.3. Example
53.4. TraceFilter
53.5. Custom SA tag in Zipkin
53.6. Custom service name
53.7. Customization of reported spans
53.8. Host locator
54. Span Data as Messages
54.1. Zipkin Consumer
54.2. Custom Consumer
55. Metrics
56. Integrations
56.1. Runnable and Callable
56.2. Hystrix
56.2.1. Custom Concurrency Strategy
56.2.2. Manual Command setting
56.3. RxJava
56.4. HTTP integration
56.4.1. HTTP Filter
56.4.2. HandlerInterceptor
56.4.3. Async Servlet support
56.5. HTTP client integration
56.5.1. Synchronous Rest Template
56.5.2. Asynchronous Rest Template
Multiple Asynchronous Rest Templates
56.5.3. Traverson
56.6. Feign
56.7. Asynchronous communication
56.7.1. @Async annotated methods
56.7.2. @Scheduled annotated methods
56.7.3. Executor, ExecutorService and ScheduledExecutorService
Customization of Executors
56.8. Messaging
56.9. Zuul
57. Running examples
VIII. Spring Cloud Consul
58. Install Consul
59. Consul Agent
60. Service Discovery with Consul
60.1. How to activate
60.2. Registering with Consul
60.3. HTTP Health Check
60.3.1. Metadata and Consul tags
60.3.2. Making the Consul Instance ID Unique
60.4. Using the DiscoveryClient
61. Distributed Configuration with Consul
61.1. How to activate
61.2. Customizing
61.3. Config Watch
61.4. YAML or Properties with Config
61.5. git2consul with Config
61.6. Fail Fast
62. Consul Retry
63. Spring Cloud Bus with Consul
63.1. How to activate
64. Circuit Breaker with Hystrix
65. Hystrix metrics aggregation with Turbine and Consul
IX. Spring Cloud Zookeeper
66. Install Zookeeper
67. Service Discovery with Zookeeper
67.1. How to activate
67.2. Registering with Zookeeper
67.3. Using the DiscoveryClient
68. Using Spring Cloud Zookeeper with Spring Cloud Netflix Components
68.1. Ribbon with Zookeeper
69. Spring Cloud Zookeeper and Service Registry
69.1. Instance Status
70. Zookeeper Dependencies
70.1. Using the Zookeeper Dependencies
70.2. How to activate Zookeeper Dependencies
70.3. Setting up Zookeeper Dependencies
70.3.1. Aliases
70.3.2. Path
70.3.3. Load balancer type
70.3.4. Content-Type template and version
70.3.5. Default headers
70.3.6. Obligatory dependencies
70.3.7. Stubs
70.4. Configuring Spring Cloud Zookeeper Dependencies
71. Spring Cloud Zookeeper Dependency Watcher
71.1. How to activate
71.2. Registering a listener
71.3. Presence Checker
72. Distributed Configuration with Zookeeper
72.1. How to activate
72.2. Customizing
72.3. ACLs
X. Spring Cloud Security
73. Quickstart
73.1. OAuth2 Single Sign On
73.2. OAuth2 Protected Resource
74. More Detail
74.1. Single Sign On
74.2. Token Relay
74.2.1. Client Token Relay
74.2.2. Client Token Relay in Zuul Proxy
74.2.3. Resource Server Token Relay
75. Configuring Authentication Downstream of a Zuul Proxy
XI. Spring Cloud for Cloud Foundry
76. Discovery
77. Single Sign On
XII. Spring Cloud Contract
78. Spring Cloud Contract
79. Spring Cloud Contract Verifier Introduction
79.1. Why?
79.1.1. Testing issues
79.2. Purposes
79.3. How
79.3.1. Define the contract
79.3.2. Client Side
79.3.3. Server Side
79.4. Step by step guide to CDC
79.4.1. Technical note
79.4.2. Consumer side (Loan Issuance)
79.4.3. Producer side (Fraud Detection server)
79.4.4. Consumer side (Loan Issuance) final step
79.5. Dependencies
79.6. Additional links
79.6.1. Spring Cloud Contract video
79.6.2. Readings
79.7. Samples
80. Spring Cloud Contract Verifier Setup
80.1. Gradle Project
80.1.1. Prerequisites
80.1.2. Add gradle plugin with dependencies
80.1.3. Gradle and Rest Assured 3.0
80.1.4. Snapshot versions for Gradle
80.1.5. Add stubs
80.1.6. Run plugin
80.1.7. Default setup
80.1.8. Configure plugin
80.1.9. Configuration options
80.1.10. Single base class for all tests
80.1.11. Different base classes for contracts
80.1.12. Invoking generated tests
80.1.13. Spring Cloud Contract Verifier on consumer side
80.2. Using in your Maven project
80.2.1. Add maven plugin
80.2.2. Maven and Rest Assured 3.0
80.2.3. Snapshot versions for Maven
80.2.4. Add stubs
80.2.5. Run plugin
80.2.6. Configure plugin
80.2.7. Important configuration options
80.2.8. Single base class for all tests
80.2.9. Different base classes for contracts
80.2.10. Invoking generated tests
80.2.11. FAQ with Maven Plugin
80.2.12. Maven Plugin and STS
80.2.13. Spring Cloud Contract Verifier on consumer side
80.3. Scenarios
80.4. Stubs and transitive dependencies
81. Spring Cloud Contract Verifier Messaging
81.1. Integrations
81.2. Manual Integration Testing
81.3. Publisher side test generation
81.3.1. Scenario 1 (no input message)
81.3.2. Scenario 2 (output triggered by input)
81.3.3. Scenario 3 (no output message)
81.4. Consumer Stub Side generation
82. Spring Cloud Contract Stub Runner
82.1. Snapshot versions
82.2. Publishing stubs as JARs
82.3. Stub Runner Core
82.3.1. Retrieving stubs
Stub downloading
Classpath scanning
82.3.2. Running stubs
Limitations
Running using main app
HTTP Stubs
Viewing registered mappings
Messaging Stubs
82.4. Stub Runner JUnit Rule
82.4.1. Maven settings
82.4.2. Providing fixed ports
82.4.3. Fluent API
82.4.4. Stub Runner with Spring
82.5. Stub Runner Spring Cloud
82.5.1. Stubbing Service Discovery
Test profiles and service discovery
82.5.2. Additional Configuration
82.6. Stub Runner Boot Application
82.6.1. How to use it?
Stub Runner Server
Spring Cloud CLI
82.6.2. Endpoints
HTTP
Messaging
82.6.3. Example
82.6.4. Stub Runner Boot with Service Discovery
82.7. Stubs Per Consumer
82.8. Common
82.8.1. Common properties for JUnit and Spring
82.8.2. Stub runner stubs ids
83. Stub Runner for Messaging
83.1. Stub triggering
83.1.1. Trigger by label
83.1.2. Trigger by group and artifact ids
83.1.3. Trigger by artifact ids
83.1.4. Trigger all messages
83.2. Stub Runner Camel
83.2.1. Adding it to the project
83.2.2. Disabling the functionality
83.2.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
83.3. Stub Runner Integration
83.3.1. Adding it to the project
83.3.2. Disabling the functionality
83.3.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
83.4. Stub Runner Stream
83.4.1. Adding it to the project
83.4.2. Disabling the functionality
83.4.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
83.5. Stub Runner Spring AMQP
83.5.1. Adding it to the project
83.5.2. Examples
Stubs structure
Triggering the message
Spring AMQP Test Configuration
84. Contract DSL
84.1. Limitations
84.2. Common Top-Level elements
84.2.1. Description
84.2.2. Name
84.2.3. Ignoring Contracts
84.2.4. HTTP Top-Level Elements
84.3. Request
84.4. Response
84.5. Dynamic properties
84.5.1. Dynamic properties inside the body
84.5.2. Regular expressions
84.5.3. Passing Optional Parameters
84.5.4. Executing Custom Methods on the Server Side
84.5.5. Referencing the Request from the Response
84.5.6. Registering Your Own WireMock Extension
84.5.7. Dynamic Properties in the Matchers Sections
84.6. JAX-RS Support
84.7. Async Support
84.8. Working with Context Paths
84.9. Messaging Top-Level Elements
84.9.1. Output Triggered by a Method
84.9.2. Output Triggered by a Message
84.9.3. Consumer/Producer
84.9.4. Common
84.10. Multiple Contracts in One File
85. Customization
85.1. Extending the DSL
85.1.1. Common JAR
85.1.2. Adding the Dependency to the Project
85.1.3. Test the Dependency in the Project’s Dependencies
85.1.4. Test a Dependency in the Plugin’s Dependencies
85.1.5. Referencing classes in DSLs
86. Using the Pluggable Architecture
86.1. Custom Contract Converter
86.1.1. Pact Converter
86.1.2. Pact Contract
86.1.3. Pact for Producers
86.1.4. Pact for Consumers
86.2. Using the Custom Test Generator
86.3. Using the Custom Stub Generator
86.4. Using the Custom Stub Runner
86.5. Using the Custom Stub Downloader
87. Spring Cloud Contract WireMock
87.1. Registering Stubs Automatically
87.2. Using Files to Specify the Stub Bodies
87.3. Alternative: Using JUnit Rules
87.4. Relaxed SSL Validation for Rest Template
87.5. WireMock and Spring MVC Mocks
87.6. Generating Stubs using RestDocs
87.7. Generating Contracts using RestDocs
88. Links
XIII. Spring Cloud Vault
89. Quick Start
90. Client Side Usage
90.1. Authentication
91. Authentication methods
91.1. Token authentication
91.2. AppId authentication
91.2.1. Custom UserId
91.3. AppRole authentication
91.4. AWS-EC2 authentication
91.5. TLS certificate authentication
91.6. Cubbyhole authentication
92. Secret Backends
92.1. Generic Backend
92.2. Consul
92.3. RabbitMQ
92.4. AWS
93. Database backends
93.1. Apache Cassandra
93.2. MongoDB
93.3. MySQL
93.4. PostgreSQL
94. Vault Client Fail Fast
95. Vault Client SSL configuration
96. Lease lifecycle management (renewal and revocation)
XIV. Appendix: Compendium of Configuration Properties