I am working on a spring webflow project and I am thinking can I use HSQLDB and not my mysql for junit testing?
How can I clone my mysql database into HSQLDB
解决方案
If you are using spring 3.1 or greater you could use spring profiles to achieve this. The default profile is loaded when no active profile is set.
destroy-method="close">
...other datasource properties also create or drop db
destroy-method="close">
...other datasource properties
In your unit test set the active profile by adding the annotation.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:app-config.xml")
@ActiveProfiles("dev")
public class TransferServiceTest {
Spring项目JUnit测试用HSQLDB替代MySQL
博主在Spring Webflow项目中思考JUnit测试能否用HSQLDB替代MySQL,以及如何将MySQL数据库克隆到HSQLDB。对于Spring 3.1及以上版本,可使用Spring Profiles实现,还给出了在单元测试中设置活动配置文件的示例代码。
497

被折叠的 条评论
为什么被折叠?



