From 7ff23e1a39b7b38b8ce9092d9b481b4dbef2fc14 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Tue, 6 Oct 2020 22:15:18 +0300 Subject: [PATCH] Add dev profile annotations; delete authority USER from Admin test user Signed-off-by: Pekka Helenius --- .../java/com/fjordtek/bookstore/BookstoreApplication.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java b/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java index a25611f..9e533c9 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java @@ -12,6 +12,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; import org.springframework.core.env.Environment; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; @@ -68,6 +69,7 @@ public class BookstoreApplication extends SpringBootServletInitializer { } @Bean + @Profile("dev") public CommandLineRunner userDatabaseRunner( UserRepository userRepository, RoleRepository roleRepository, @@ -123,7 +125,6 @@ public class BookstoreApplication extends SpringBootServletInitializer { // Add example roles for admin user userRoleRepository.save(new UserRole(adminAU, adminAR)); userRoleRepository.save(new UserRole(adminAU, salesAR)); -// userRoleRepository.save(new UserRole(adminAU, userAR)); // Add an example role for helpdesk user userRoleRepository.save(new UserRole(helpdeskAU, helpdeskAR)); @@ -152,6 +153,7 @@ public class BookstoreApplication extends SpringBootServletInitializer { } @Bean + @Profile("dev") public CommandLineRunner bookDatabaseRunner( BookRepository bookRepository, BookHashRepository bookHashRepository,