使用H2进行Javax验证

问题描述 投票:0回答:1

我有这个测试

@Test
public void mustPostAccountCreationExceptionWithMoreThanTwoDigitsAfterComma(){
    thrown.expect(ConstraintViolationException.class);

    account.setSaldo(new BigDecimal("12.000"));
    accountRepository.save(account);
}

这场saldo的验证:

@Digits(fraction = 2, integer = 9)
private BigDecimal saldo;

但是H2没有用,Postgresql也可以

java spring h2
1个回答
0
投票

要添加pom.xml:

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
<scope>test</scope>

并删除Postgresql的config-beans或发布我的项目,我可以帮助你

© www.soinside.com 2019 - 2024. All rights reserved.