Class FabricSeeder
java.lang.Object
com.needleandstitch.pavuk.data.FabricSeeder
- All Implemented Interfaces:
org.springframework.boot.CommandLineRunner
@Component
@Order(9)
public class FabricSeeder
extends Object
implements org.springframework.boot.CommandLineRunner
Seeder class for initializing default fabrics in the database.
This class checks that certain fabrics 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 Summary
ConstructorsConstructorDescriptionFabricSeeder
(FabricRepository fabricRepository, ImageRepository imageRepository, ColorRepository colorRepository) Constructs a new FabricSeeder with the specified repository. -
Method Summary
-
Constructor Details
-
FabricSeeder
public FabricSeeder(FabricRepository fabricRepository, ImageRepository imageRepository, ColorRepository colorRepository) Constructs a new FabricSeeder with the specified repository.- Parameters:
fabricRepository
- The repository used for interacting with the Fabric entitiesimageRepository
- The repository used for interacting with the Image entitiescolorRepository
- The repository used for interacting with the Color entities
-
-
Method Details
-
run
Seeds the database with default fabrics if they are not already present.- Specified by:
run
in interfaceorg.springframework.boot.CommandLineRunner
- Parameters:
args
- The command-line arguments passed to the application- Throws:
Exception
- if any error occurs during the seeding process
-