I'm using Spring Boot 2.0.4.RELEASE, and configured src/test/resources/application.yml to be
spring:
jpa:
show-sql: false
hibernate:
dialect: org.hibernate.dialect.SQLServer2012Dialect
ddl-auto: none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate:
generate_statistics: false
show_sql: false
I have a very simple test:
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ExtendWith(SpringExtension.class)
public class MyTest {
...
}
The test ignores the properties (can be easily seen as it prints the hibernate statements). Putting the same properties in a application.properties file is working.
Changing the name to application-test.yml and running on profile test didn't help either.
When changing the @DataJpaTest annotation to @SpringBootTest it's working...
It's important to note that the rest of the properties (things related to my application specifically and are not with spring.* prefix are being read and used normally
I do prefer to use a yaml file (like in /src/main/resources) and rather not load a complete @SpringBootTest just for pure JPA tests... Is there anything else that I can configure for this to work?