Spring Boot

Application Properties & YAML

Configuration with application.properties/yml, @Value, @ConfigurationProperties, profiles, external properties

16 питань зі співбесід·
Junior
1

What is the main difference between application.properties and application.yml in Spring Boot?

Відповідь

Both files are used to configure Spring Boot, but use different formats. YAML format (.yml) allows hierarchical structure with indentation, making it more readable for complex configurations. Properties format (.properties) uses flat key=value syntax. Spring Boot automatically loads either one, with priority to .properties if both exist.

2

Which property allows changing the embedded server port in Spring Boot?

Відповідь

The server.port property configures the HTTP port of the embedded server (Tomcat, Jetty, Undertow). By default, Spring Boot starts on port 8080. This property can be defined in application.properties (server.port=9000) or in YAML (server: port: 9000). It can also be overridden via JVM argument (-Dserver.port=9000) or environment variable.

3

How to declare the property spring.datasource.url in YAML for a local PostgreSQL database?

Відповідь

In YAML, hierarchical properties use indentation (spaces, not tabs). The property spring.datasource.url breaks down into spring → datasource → url. Each level is indented by 2 spaces. This hierarchical structure makes configuration more readable than the flat properties version (spring.datasource.url=jdbc:postgresql://localhost:5432/mydb).

4

How to activate the 'dev' profile at startup of a Spring Boot application?

5

Which annotation allows injecting a configuration property into a Spring bean?

+13 питань зі співбесід

Інші теми співбесід Spring Boot

Spring Core - IoC & DI

Junior
22 запитань

Spring Boot Auto-Configuration

Junior
20 запитань

Spring Boot Starters

Junior
18 запитань

Logging with SLF4J & Logback

Junior
20 запитань

Spring Boot DevTools

Junior
15 запитань

Spring MVC Basics

Mid-Level
20 запитань

Spring REST Controllers

Mid-Level
20 запитань

Request & Response Handling

Mid-Level
20 запитань

Exception Handling

Mid-Level
25 запитань

Bean Validation

Mid-Level
25 запитань

Spring Data JPA Basics

Mid-Level
25 запитань

JPA Entities & Relationships

Mid-Level
30 запитань

JPA Queries

Mid-Level
30 запитань

Spring Data Repositories

Mid-Level
25 запитань

Spring Security Basics

Mid-Level
25 запитань

Spring Boot Actuator

Mid-Level
20 запитань

Unit Testing with JUnit & Mockito

Mid-Level
30 запитань

Spring Boot Testing

Mid-Level
30 запитань

Profiles & Environment

Mid-Level
20 запитань

RestTemplate & WebClient

Mid-Level
24 запитань

Async & Scheduling

Mid-Level
25 запитань

Caching with Spring

Mid-Level
25 запитань

Spring WebFlux (Reactive)

Mid-Level
25 запитань

Spring Transactions

Senior
30 запитань

Advanced Authentication & Authorization

Senior
30 запитань

JWT & Stateless Security

Senior
20 запитань

OAuth2 & Authorization Server

Senior
20 запитань

Spring Boot & Docker

Senior
19 запитань

Microservices with Spring

Senior
25 запитань

Spring Cloud Config

Senior
19 запитань

Performance Optimization

Senior
30 запитань

GraalVM Native Images

Senior
20 запитань

Опануй Spring Boot для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно