What is @PropertySource & @PropertySources Annotation? Spring & Spring Boot Annotations Series#12

Опубликовано: 23 Октябрь 2024
на канале: XAdmin
191
5

In this video, we are going to discuss about the @PropertySource & @PropertySources Annotation in Spring Framework.
we will see with example how to fetch/get value from the custom properties file in spring boot application.
Spring Annotation
Spring Boot Annotation

-In the Spring Framework, @PropertySource is used to provide access to the custom properties file to Spring Environment.

Spring @PropertySources annotation is used to provide access to the multiple properties files to spring environment.

These annotation is used with @Configuration classes.

Spring @PropertySource annotation is repeatable, mean you can have multiple propertySouce on a Configuration class.

we can use @Value annotation and Environment class to read the property file.
#SpringFramework #springboot #spring #springAnnotations