Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get name of the file loaded by @PropertySource

Is there anyway I can know in my program, the full path of file loaded through @PropertySource annotation of Spring. I need it to show in logs so that one can know which property file is being used in the application

like image 406
Ahmad Avatar asked Mar 13 '23 19:03

Ahmad


1 Answers

This information is logged already by StandardServletEnvironment. You can set log level to DEBUG for org.springframework.web.context.support.StandardServletEnvironment class to show details in your logs.

If you use spring-boot you can simply add following line into your application.properties file.

logging.level.org.springframework.web.context.support.StandardServletEnvironment = DEBUG
like image 102
Selim Ok Avatar answered Mar 16 '23 20:03

Selim Ok