Class PostServiceSeeder

java.lang.Object
com.needleandstitch.pavuk.data.PostServiceSeeder
All Implemented Interfaces:
org.springframework.boot.CommandLineRunner

@Component @Order(11) public class PostServiceSeeder extends Object implements org.springframework.boot.CommandLineRunner
Seeder class for initializing default post services in the database. This class checks that certain post services are present in the database and adds them if they are missing.

The seeding process is triggered during application startup.

Since:
15.12.2024
Version:
1.0.0
Author:
Needle & Stitch
  • Constructor Details

    • PostServiceSeeder

      public PostServiceSeeder(PostServiceRepository postServiceRepository)
      Constructs a new PostServiceSeeder with the specified repository.
      Parameters:
      postServiceRepository - The repository used for interacting with the PostService entities
  • Method Details

    • run

      public void run(String... args) throws Exception
      Seeds the database with default post services if they are not already present.
      Specified by:
      run in interface org.springframework.boot.CommandLineRunner
      Parameters:
      args - The command-line arguments passed to the application
      Throws:
      Exception - if any error occurs during the seeding process