File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/com/back/global/initData Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 99import org .springframework .context .annotation .Bean ;
1010import org .springframework .context .annotation .Configuration ;
1111import org .springframework .context .annotation .Profile ;
12+ import org .springframework .core .env .Environment ;
1213import org .springframework .security .crypto .password .PasswordEncoder ;
1314import org .springframework .transaction .annotation .Transactional ;
1415
1718public class DevInitData {
1819 private final UserRepository userRepository ;
1920 private final PasswordEncoder passwordEncoder ;
20-
21+ private final Environment environment ;
2122 @ Bean
2223 ApplicationRunner DevInitDataApplicationRunner () {
2324 return args -> {
25+ String activeProfile = environment .getProperty ("spring.profiles.active" , "none" );
26+ if (!"default" .equals (activeProfile )) {
27+ return ; // default 환경이 아니면 실행하지 않음
28+ }
2429 initUsers ();
2530 };
2631 }
You can’t perform that action at this time.
0 commit comments