Class RoleSeeder
java.lang.Object
com.needleandstitch.pavuk.data.RoleSeeder
- All Implemented Interfaces:
org.springframework.boot.CommandLineRunner
@Component
@Order(1)
public class RoleSeeder
extends Object
implements org.springframework.boot.CommandLineRunner
Seeder class for initializing default roles in the database.
This class checks that certain roles 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
ConstructorsConstructorDescriptionRoleSeeder
(RoleRepository roleRepository) Constructs a new RoleSeeder with the specified repository. -
Method Summary
-
Constructor Details
-
RoleSeeder
Constructs a new RoleSeeder with the specified repository.- Parameters:
roleRepository
- The repository used for interacting with the Role entities
-
-
Method Details
-
run
Seeds the database with default roles 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
-