-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50426d2
commit fa1fa0a
Showing
4 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
import com.orbanszlrd.quizapi.modules.user.model.User; | ||
import com.orbanszlrd.quizapi.modules.user.repository.UserRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.stereotype.Service; | ||
|
||
|
@@ -15,12 +13,9 @@ public class UserImportService { | |
private final UserRepository userRepository; | ||
private final PasswordEncoder passwordEncoder; | ||
|
||
@Bean | ||
public CommandLineRunner userImporter() { | ||
return args -> { | ||
userRepository.save(new User(1L, "owner", "[email protected]", passwordEncoder.encode("owner"), true, Role.OWNER)); | ||
userRepository.save(new User(2L, "admin", "[email protected]", passwordEncoder.encode("admin"), true, Role.ADMIN)); | ||
userRepository.save(new User(3L, "user", "[email protected]", passwordEncoder.encode("user"), true, Role.USER)); | ||
}; | ||
public void createUsers() { | ||
userRepository.save(new User("owner", "[email protected]", passwordEncoder.encode("owner"), true, Role.OWNER)); | ||
userRepository.save(new User("admin", "[email protected]", passwordEncoder.encode("admin"), true, Role.ADMIN)); | ||
userRepository.save(new User("user", "[email protected]", passwordEncoder.encode("user"), true, Role.USER)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters