Spring Boot FAQ: Top Questions
9. What is the difference between application.properties and application.yml?
Both are used for external configuration in Spring Boot, but differ in syntax and readability. .properties
uses key-value pairs while .yml
uses indentation-based structure (YAML).
📘 Comparison:
- Properties: Easier for simple settings.
- YAML: Better for nested configurations.
📥 Example:
# application.yml
server:
port: 8081
🏆 Expected Output:
Server will start on port 8081.
🛠️ Use Cases:
- Use properties for basic setups.
- Use YAML for structured and complex configs.