Junior — Middle
What is the role of the application.properties file in configuring Spring applications?
sobes.tech AI
Answer from AI
The application.properties file in Spring is used for centralized configuration of application parameters. It can specify database connection settings, server parameters, resource paths, security settings, and more. Spring automatically loads this file at startup and applies the specified properties.
Example content of application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
spring.datasource.username=root
spring.datasource.password=secret
server.port=8080
logging.level.org.springframework=DEBUG
Thus, application.properties allows convenient management of configuration without changing code.