In this video , we will discuss all the three ways to read from application.properties file in the spring boot.
-----------------------------------
Q. What is application.properties?
It is a configuration file in Spring Boot applications that stores key-value pairs of properties.
These properties are used to configure various aspects of the application such as the server port, database connection, logging configuration, etc.
Q. Purpose of application.properties?
- Provide a centralized location for configuring various aspects of a Spring Boot application.
- It allows developers to externalize configuration from the application code, making it easier to modify or override configuration without having to recompile the application.
- Application.properties makes it easy to share configuration across multiple environments, such as development, testing, and production.
Q.Ways to read from application.properties?
Three distinct methods for reading application properties in a Spring Boot application.
- Using the Environment object.
- Using the @ConfigurationProperties annotation.
- Using the @Value annotation.
Негізгі бет Spring Boot : Three ways to read from application.properties file with examples | @Value
Пікірлер