Spring Boot Call -Methode nach dem Start mit Repository
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