Metode Panggilan Boot Musim Semi Setelah Startup dengan Repositori
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class Initializer implements CommandLineRunner {
private final YourRepository yourRepository;
public Initializer(YourRepository yourRepository) {
this.yourRepository = yourRepository;
}
@Override
public void run(String... args) throws Exception {
// your logic, for example:
yourRepository.findAll();
}
}
Zwazel