public interface DataFixture
public class MyInitializer implements DataFixture {
@Autowired
private UserRepository userRepository;
public boolean shouldRun() { userRepository.findUserByName("Bob") == null; }
public void run() {
userRepository.save(new User("Bob"));
}
}
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ORDER |
| Modifier and Type | Method and Description |
|---|---|
default int |
getOrder()
Get the order of the data initializer, to be sorted lowest to highest
|
void |
run()
Run the data initialization
|
boolean |
shouldRun()
Test if this initializer should be run
|
static final int DEFAULT_ORDER
Copyright © 2018 6point6 Limited. All rights reserved.