I am new to Java and Spring and I have searched this question but I can't get a clear answer I am trying to load settings from an external file using a PropertySource
annotation. Since I have multiple instances of tomcat running, I want to load settings from the file that is present in my catalina base directory. But when I try putting @PropertySource("file:///${catalina.base}/ldap.properties")
and do a mvn install
I get the following error
Failed to parse configuration class [ca.rtss.ldaptest.LdaptestApplication]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'catalina.base' in value "file:///${catalina.base}/ldap.properties"
However, when I hardcode the path it works fine. So, I am not sure why this placeholder is not working as it used to work in a normal Spring application. Is there a place where I need to set this placeholder?
Found the solution. I needed to run the app in the tomcat context rather than with maven. I imported tomcat server in Intellij and then did a build. It worked afterwards