Spring @PropertySource Annotation Example
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWYI0pPaE3C3fjL7AC_hq9MRISOqFKTw0l_dCUAWIVHKn2Q12S2EZXCpun2dzfWnuu2hphEP9HMLRVv7E4xamKMmXFgQzkuWf9h8S2GJK5gvGVJBcnmbgH-oeC1j_t9vvF2e6aILSVX6jEQ6sgILAYgU9uwZe70Lb1CxD1wdtuRzIZAKRUx0lp60wNXw/w400-h185/propertysource.png)
In this section we will learn about @PropertySource Annotation. The @PropertySource is a convenient annotation for including PropertySource to Spring's Environment and allowing to inject properties via @Value into class attributes. This annotation is used with @Configuration classes. Spring @PropertySource annotation is repeatable, means you can have multiple @PropertySource on a Configuration class. This feature is available if you are using Java 8 or higher version. For earlier java versions, @PropertySources was the way to provide multiple property files to the configuration class. The following example creates a Spring Boot web application which uses @PropertySource annotation . Project Directory db.properties DB_DRIVER_CLASS = com.mysql.jdbc.Driver DB_URL = jdbc:mysql://localhost:3306/Demo DB_USERNAME = knf DB_PASSWORD = root message.properties hello.message = Hello World knowledgefactory.properties knf.message = Hi, Greetings from knowledgefactory.net. language.lis