***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method saveData in com.example.SpringBootJournalApplication required a bean of type 'repository.JournalRepository' that could not be found.
Action:
Consider defining a bean of type 'repository.JournalRepository' in your configuration.
When i run the project Spring fails to start and i have this error.
This is the SpringApplication.run class, all dependencies are properly defined in the pom.xml and downloaded.
@SpringBootApplication
public class SpringBootJournalApplication {
@Bean
InitializingBean saveData(JournalRepository repo){
return ()->{
repo.save(new Journal("text1",LocalDate.now(),"date1"));
repo.save(new Journal("text2",LocalDate.now(),"date2"));
repo.save(new Journal("text3",LocalDate.now(),"date3"));
repo.save(new Journal("text4",LocalDate.now(),"date4"));
};
}
public static void main(String[] args) {
SpringApplication.run(SpringBootJournalApplication.class, args);
}
}