Create a maven project and add Spring dependencies
Create a Spring configuration class
Place one text file in to the class path
vinod.txt in to src/main/resources folder
Run the program and check the console for the output..
In the above program we are getting the Resource from the Spring context it self, if we wanted to get it from our own bean, spring provides ResourceLoaderAware interface , this will helps to inject ResourceLoader and we can use that bean to load the resources
Note: Internally AplicationContext also using the same ResourceLoader to load the resources
Let us see how can we implement this..
Modified Main class
loading resources classpath:vinod.txt
hai i am vinod