【发布时间】:2012-11-27 09:17:58
【问题描述】:
我有标准的 maven 文件夹结构:
src/main/java
src/main/resources
src/test/java
src/test/resources
我的 appicationContext 包含以下内容:
<!-- load properties files -->
<context:property-placeholder location="classpath*:*.properties"/>
我已经定义了 2 个hibernate.properties 文件——一个用于src/main/resources,一个用于src/ test/resources。我预计当我运行测试时,我的测试hibernate.properties 将覆盖生产hibernate.properties。而不是加载两个文件并使用生产版本:
Loading properties file from file [D:\projects\video_crawler_v3\out\test\core\hibernate.properties]
Loading properties file from file [D:\projects\video_crawler_v3\out\production\core\hibernate.properties]
如何正确设置我的属性文件?我正在使用 Intellij IDEA 编译和运行测试
【问题讨论】:
-
您可以添加您的
hibernate.properties文件的示例吗?我只想看看您的主要配置和测试配置之间的差异。谢谢。 -
我觉得命名属性占位符配置文件
hibernate.properties不是个好主意,`hibernate.properties'一般是Hibernate本身的配置文件,和Spring属性占位符无关.
标签: java spring properties intellij-idea