Spring Boot Interview Question

What is the application.properties file in Spring Boot?

Updated 2026-07-10 · Beginner friendly
Quick answer

The application.properties file, or its YAML form application.yml, is where you put configuration for your Spring Boot app, such as the server port, database URL, and logging levels. Spring Boot reads it automatically at startup. You can also keep separate files per environment using profiles, like application-dev.properties and application-prod.properties.

What goes in it

server.port=8081
spring.datasource.url=jdbc:mysql://localhost/shop
logging.level.root=INFO

Profiles for each environment

Profiles let you keep different settings for development, testing, and production. You activate one with spring.profiles.active, and Spring loads the matching file, so you never hard code environment specific values.

In the interview

Mention that you keep secrets like passwords out of this file, using environment variables or a secrets manager instead. Raising security here shows maturity that many candidates miss.

Want the full Spring Boot guide?

Read every Spring Boot concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the Spring Boot guide All Spring Boot questions