[英]In-memory database tests not creating tables
I have test class annotated with these: 我已经用这些注释了测试类:
@SpringBootTest
@TestPropertySource(properties={"spring.jpa.hibernate.ddl-auto=create"})
@AutoConfigureTestDatabase
These is HSQLDB in Maven dependencies so it is tried to be used during the tests cause of @AutoConfigureTestDatabase annotation. 这些是Maven依赖项中的HSQLDB,因此尝试在@AutoConfigureTestDatabase批注的测试原因中使用它。 However tables are not created, Hibernate instead is just validating that tables are not found.
但是没有创建表,而是Hibernate只是在验证未找到表。 Writing property value into application.properties does not change anything.
将属性值写入application.properties不会发生任何变化。 I remember when I was developing at some moment it worked few times for me, but I did not notice what special/different I was doing that time.
我记得当我在某个时候进行开发时,它对我来说工作了几次,但是我没有注意到那段时间我做了什么特别/不同的事情。 Is there anything else to do/check or am I doing it wrong?
还有其他事情要检查吗?还是我做错了?
Try to add this annotations to your test: 尝试将以下注释添加到您的测试中:
@SpringBootTest(classes = {<your start class>.class})
@RunWith(SpringJUnit4ClassRunner.class)
ps don't forget to replace to your start class. ps别忘了替换为您的入门班。
Hope this will help you. 希望这会帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.