我有非标准的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'文件的例子吗?我只是想看看你的主配置和测试配置之间的差异。谢谢。 – Jonathan
我不认为命名属性占位符配置文件'hibernate.properties'是一个好主意,'hibernate.properties'通常是Hibernate自身的配置文件,并且与Spring属性占位符无关。 –