@Rollback(value = false)
@Test
public void test() throws Exception {
// 不开启线程,在主线程中执行没有问题
// for (int i = 0; i < 10; i++) {
// normal(Thread.currentThread().getId(), i);
// }
Thread thread1 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
normal(Thread.currentThread().getId(), i);
}
}
});
Thread thread2 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
normal(Thread.currentThread().getId(), i);
}
}
});
thread1.start();
thread2.start();
}
public void normal(long id, int n) {
auditLoggingService.insertAuditLogging("修改个人密码成功" + id + "/" + n, 56, 6, 0,
BaseConstants.AuditLoggingOperatorType.MODIFY, "修改个人密码", "修改密码", 0, "", "", "无", "", BaseConstants.UserInfo.USER_CAT_INNER, "yangyan", "");
}
加上thread1.join(); thread2.join(); 试试
for end