[英]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.这个项目有2年没有动过。 Following code is written in spring-security.xml
以下代码写在 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.我检查了
src/main/resources
、整个代码库、整个系统(macOS 级别搜索),但找不到 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.我确定的是,当应用程序在本地(在我的笔记本电脑中)运行时,它使用
SPRING_DATASOURCE_URL
、 USERNAME
和PASSWORD
连接到远程 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' PS:我确实尝试了文件搜索等搜索字符串“SPRING_DATASOURCE_URL”
Moving my comment to answer.移动我的评论来回答。
Possibly the property file is in the server folder where the web app is deployed.属性文件可能位于部署 web 应用程序的服务器文件夹中。 Further investigation can be done by enabling Spring debug logs.
可以通过启用 Spring 调试日志来进行进一步调查。
How can I debug and find out the location of the file?
如何调试并找出文件的位置?
Set breakpoints in all public methods of PropertyPlaceholderConfigurer and its parent classes.在 PropertyPlaceholderConfigurer 及其父类的所有公共方法中设置断点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.