Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 31ea98b5 authored by Fredo's avatar Fredo
Browse files

[GREEN] Fix DevDataSeeder not working

parent 260d989e
No related branches found
No related tags found
1 merge request!1Login registration
...@@ -2,10 +2,15 @@ package com.safetypin.authentication.seeder; ...@@ -2,10 +2,15 @@ package com.safetypin.authentication.seeder;
import com.safetypin.authentication.model.User; import com.safetypin.authentication.model.User;
import com.safetypin.authentication.repository.UserRepository; import com.safetypin.authentication.repository.UserRepository;
import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Profile;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import java.time.LocalDate; import java.time.LocalDate;
@Component
@Profile({"dev"})
public class DevDataSeeder implements Runnable { public class DevDataSeeder implements Runnable {
private final UserRepository userRepository; private final UserRepository userRepository;
...@@ -16,6 +21,11 @@ public class DevDataSeeder implements Runnable { ...@@ -16,6 +21,11 @@ public class DevDataSeeder implements Runnable {
this.passwordEncoder = passwordEncoder; this.passwordEncoder = passwordEncoder;
} }
@PostConstruct
public void init() {
run();
}
@Override @Override
public void run() { public void run() {
// Only seed if there are no users in the repository // Only seed if there are no users in the repository
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment