Class ShippingInfoSeeder
java.lang.Object
com.needleandstitch.pavuk.data.ShippingInfoSeeder
- All Implemented Interfaces:
org.springframework.boot.CommandLineRunner
@Component
@Order(12)
public class ShippingInfoSeeder
extends Object
implements org.springframework.boot.CommandLineRunner
Seeder class for initializing default shipping infos in the database.
This class checks that certain shipping infos 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
ConstructorsConstructorDescriptionShippingInfoSeeder
(ShippingInfoRepository shippingInfoRepository, PostServiceRepository postServiceRepository) Constructs a new ShippingInfoSeeder with the specified repository. -
Method Summary
-
Constructor Details
-
ShippingInfoSeeder
public ShippingInfoSeeder(ShippingInfoRepository shippingInfoRepository, PostServiceRepository postServiceRepository) Constructs a new ShippingInfoSeeder with the specified repository.- Parameters:
shippingInfoRepository
- The repository used for interacting with the ShippingInfo entitiespostServiceRepository
- The repository used for interacting with the PostService entities
-
-
Method Details
-
run
Seeds the database with default shipping infos 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
-