@@ -0,0 +1,1355 @@
+package com.example.framework.model.init;%0A%0Aimport com.example.framework.model.Comment;%0Aimport com.example.framework.model.Post;%0Aimport com.example.framework.model.Tag;%0Aimport com.example.framework.repository.PostRepository;%0Aimport com.github.javafaker.Faker;%0Aimport lombok.RequiredArgsConstructor;%0Aimport org.springframework.boot.context.event.ApplicationReadyEvent;%0Aimport org.springframework.context.annotation.Profile;%0Aimport org.springframework.context.event.EventListener;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport java.util.Arrays;%0Aimport java.util.stream.IntStream;%0A%0A%0A@Service%0A@RequiredArgsConstructor%0A@Profile(%22!production%22)%0Aclass FixturesInitializer %7B%0A%0A%09private final Faker faker = new Faker();%0A%0A%09private final PostRepository postRepository;%0A%0A%09@EventListener%0A%09public void init(ApplicationReadyEvent event) %7B%0A%0A%09%09if (postRepository.count() %3E 0) %7B%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09IntStream.range(0, 10).forEach(%0A%09%09%09n -%3E %7B%0A%09%09%09%09Tag tag = new Tag();%0A%09%09%09%09tag.setName(faker.lorem().word());%0A%0A%09%09%09%09Comment comment = new Comment();%0A%09%09%09%09comment.setText(faker.lorem().sentence());%0A%0A%09%09%09%09Post post = new Post();%0A%09%09%09%09post.setTitle(faker.company().name());%0A%09%09%09%09post.setContent(faker.lorem().paragraph());%0A%09%09%09%09post.setComments(Arrays.asList(comment));%0A%09%09%09%09post.setTags(Arrays.asList(tag));%0A%0A%09%09%09%09comment.setPost(post);%0A%0A%09%09%09%09postRepository.save(post);%0A%09%09%09%7D%0A%09%09);%0A%09%7D%0A%7D%0A

add fixtures initializer - use faker library - use with non-prduction profile only