26 lines
835 B
Java
26 lines
835 B
Java
package com.wyattjmiller.home.recipefoliobackend.utils;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.boot.CommandLineRunner;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import com.wyattjmiller.home.recipefoliobackend.controller.RecipeRepository;
|
|
import com.wyattjmiller.home.recipefoliobackend.model.Recipe;
|
|
|
|
@Configuration
|
|
class LoadDatabase {
|
|
private static final Logger log = LoggerFactory.getLogger(LoadDatabase.class);
|
|
|
|
@Bean
|
|
CommandLineRunner initDatabase(RecipeRepository repository) {
|
|
return args -> {
|
|
log.info("Preloading " + repository.save(new Recipe("Peanut Butter and Jelly Sandwhich", "The defacto sandwhich", "Peanut Butter, Jelly, and bread")));
|
|
};
|
|
}
|
|
}
|
|
|