This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues or pull requests.

26 lines
835 B
Java
Raw Normal View History

2022-08-06 19:09:20 -04:00
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 -> {
2022-08-07 16:00:49 -04:00
log.info("Preloading " + repository.save(new Recipe("Peanut Butter and Jelly Sandwhich", "The defacto sandwhich", "Peanut Butter, Jelly, and bread")));
2022-08-06 19:09:20 -04:00
};
}
}