-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPluginMain.java
36 lines (28 loc) · 953 Bytes
/
PluginMain.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.example.plugin;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
public class PluginMain implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(PluginMain.class);
@Autowired
public UserMapper userMapper;
@Override
public void run(String... args) throws Exception {
Long uid = save();
find(uid);
}
private Long save() {
User user = new User();
user.setName("user");
Assertions.assertEquals(1, userMapper.save(user));
log.info("save: uid: {}", user.getId());
Assertions.assertNotNull(user.getId());
return user.getId();
}
private void find(Long uid) {
User user = userMapper.find(uid);
log.info("user: {}", user);
}
}