Spring Cloud Spring Cloud Configuration Management 2 — Questions and Answers
Question 1: How does a Spring Cloud Config Client specify which Config Server to connect to?
- Via the SPRING_CONFIG_URI environment variable only
- Via spring.config.import or spring.cloud.config.uri in application properties (Correct answer)
- By scanning the classpath for a config-server.properties file
- Through the Eureka service registry using the service name 'config-server'
Correct answer: Via spring.config.import or spring.cloud.config.uri in application properties
Clients configure the Config Server URL using spring.cloud.config.uri (legacy) or spring.config.import=configserver: (modern approach) in their bootstrap or application properties.
Question 2: What is the purpose of the `bootstrap.yml` file in a Spring Cloud Config Client application?
- It overrides all other property files at runtime
- It is loaded before the application context and used to configure the Config Server connection (Correct answer)
- It defines the database schema for the application
- It stores encrypted secrets that are decrypted at startup
Correct answer: It is loaded before the application context and used to configure the Config Server connection
bootstrap.yml is processed by a bootstrap context that starts before the main application context, allowing Config Server settings to be available when the app context initializes.
Question 3: Which Spring Cloud Config Server backend stores configuration in a relational database rather than Git?
- JDBC backend (spring.cloud.config.server.jdbc) (Correct answer)
- SQL backend (spring.cloud.config.server.sql)
- RDBMS backend (spring.cloud.config.server.rdbms)
- Database backend (spring.cloud.config.server.db)
Correct answer: JDBC backend (spring.cloud.config.server.jdbc)
The JDBC backend allows Config Server to store and retrieve configuration from a relational database using a PROPERTIES table, configured via spring.cloud.config.server.jdbc.
Question 4: How does Spring Cloud Config Server handle encrypted property values stored in Git?
- It stores them in Base64 and decodes on the fly
- It uses a {cipher} prefix and decrypts values using a configured key before serving them (Correct answer)
- Encryption is handled entirely by the client after fetching
- It delegates decryption to HashiCorp Vault automatically
Correct answer: It uses a {cipher} prefix and decrypts values using a configured key before serving them
Properties prefixed with {cipher} are automatically decrypted by Config Server using a symmetric or asymmetric key configured via encrypt.key before the values are returned to clients.
Question 5: What is a 'label' in the context of Spring Cloud Config Server with a Git backend?
- A metadata tag for the service instance in Eureka
- A Git branch, tag, or commit SHA used to select the configuration version (Correct answer)
- A namespace prefix applied to all property keys
- An environment profile that overrides application.yml values
Correct answer: A Git branch, tag, or commit SHA used to select the configuration version
In Spring Cloud Config Server, the label corresponds to a Git branch, tag, or commit SHA, allowing clients to pin their configuration to a specific version.
Question 6: Which Spring Cloud project provides integration with HashiCorp Vault as a Config Server backend for storing secrets?
- Spring Cloud Secrets
- Spring Cloud Vault (Correct answer)
- Spring Cloud Security
- Spring Cloud KMS
Correct answer: Spring Cloud Vault
Spring Cloud Vault integrates with HashiCorp Vault to read secrets and configuration, either as a standalone Config Client or as a backend for Spring Cloud Config Server.
How does a Spring Cloud Config Client specify which Config Server to connect to?