-
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
b86f6e4
commit 038d3db
Showing
7 changed files
with
50 additions
and
34 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 |
---|---|---|
@@ -1,7 +1,22 @@ | ||
package com.inq.wishhair.wesharewishhair; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.inq.wishhair.wesharewishhair.hairstyle.domain.HairStyle; | ||
import com.inq.wishhair.wesharewishhair.hairstyle.domain.HairStyleRepository; | ||
import com.inq.wishhair.wesharewishhair.user.domain.UserRepository; | ||
import com.inq.wishhair.wesharewishhair.user.domain.entity.Password; | ||
import com.inq.wishhair.wesharewishhair.user.domain.entity.Sex; | ||
import com.inq.wishhair.wesharewishhair.user.domain.entity.User; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@SpringBootApplication | ||
public class WeShareWishHairApplication { | ||
|
@@ -10,4 +25,27 @@ public static void main(String[] args) { | |
SpringApplication.run(WeShareWishHairApplication.class, args); | ||
} | ||
|
||
@Component | ||
@Profile("prod") | ||
@RequiredArgsConstructor | ||
static class TestData { | ||
|
||
private final UserRepository userRepository; | ||
private final HairStyleRepository hairStyleRepository; | ||
private final PasswordEncoder passwordEncoder; | ||
|
||
@PostConstruct | ||
public void setUp() { | ||
userRepository.save(User.createUser( | ||
"[email protected]", | ||
Password.encrypt("hello123@", passwordEncoder), | ||
"userA", | ||
"hello", | ||
Sex.MAN | ||
)); | ||
|
||
hairStyleRepository.save(HairStyle.createHairStyle("hairStyleA", Sex.MAN, new ArrayList<>(), new ArrayList<>())); | ||
} | ||
} | ||
|
||
} |
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
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