Package com.mindstore.backend.security
Class Initializer
java.lang.Object
com.mindstore.backend.security.Initializer
- All Implemented Interfaces:
org.springframework.boot.CommandLineRunner
@Component
public class Initializer
extends Object
implements org.springframework.boot.CommandLineRunner
Initializer class that is used to populate the database with texts and a test user.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializer(TextIndexService textIndexService, UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) initializer class -
Method Summary
-
Constructor Details
-
Initializer
public Initializer(TextIndexService textIndexService, UserRepository userRepository, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) initializer class- Parameters:
textIndexService- service class that holds logic for manipulating textDocumentsuserRepository- repository class for userspasswordEncoder- used to encode passwords for users
-
-
Method Details
-
run
- Specified by:
runin interfaceorg.springframework.boot.CommandLineRunner- Parameters:
args- function: initializes the application by adding the textDocuments that are present in the data.json and by adding a test user that can be used in tests note: the first step is deleting all existing entries --> this can be commented out later- Throws:
Exception- when the data file is not found or the initialization cannot be done (for whatever reasons)
-