简体   繁体   中英

How to find the application.properties in spring web app, while location is mentioned as classpath:/application.properties but file is missing?

This project was not touched for 2 years. Following code is written in spring-security.xml

  <b:bean id="mappings" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <b:property name="location">
            <b:value>classpath:/application.properties</b:value>
        </b:property>
  </b:bean> 
  <b:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <b:property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
        <b:property name="url" value="${SPRING_DATASOURCE_URL}" />
        <b:property name="username" value="${SPRING_DATASOURCE_USERNAME}" />
        <b:property name="password" value="${SPRING_DATASOURCE_PASSWORD}" />
  </b:bean>

I checked src/main/resources , entire code base, entire system (macOS level search) and I couldn't find application.properties.

What I know for sure is, when the application is run locally(in my laptop) it uses SPRING_DATASOURCE_URL , USERNAME and PASSWORD to connect to remote AWS db.

Question: How can I debug and find out the location of the file?

PS: I did try file search etc. for search string 'SPRING_DATASOURCE_URL'

Moving my comment to answer.

Possibly the property file is in the server folder where the web app is deployed. Further investigation can be done by enabling Spring debug logs.

How can I debug and find out the location of the file?

Set breakpoints in all public methods of PropertyPlaceholderConfigurer and its parent classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM