CommandLineRunner
CommandLineRunner
@FunctionalInterface
@Bean
、合計methods
run(String ... args) -> void
@Bean
public CommandLineRunner runner(UserEntityRepository userEntityRepository, BoardRepository boardRepository) {
return args -> {
UserEntity user = UserEntity.builder()
.username("james")
.password("1111")
.email("[email protected]")
.build();
IntStream.rangeClosed(1, 200).forEach(i ->
boardRepository.save(
Board.builder()
.title("게시글" + i)
.subTitle("순서 " + i)
.content("content")
.boardType(BoardType.FREE)
.user(user)
.build()
)
);
};
}
Reference
この問題について(CommandLineRunner), 我々は、より多くの情報をここで見つけました https://velog.io/@apayaya/CommandLineRunnerテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol