// Path: service/src/main/java/info/rolandkrueger/userservice/application/DevelopmentProfileConfiguration.java
// @Component
// @Profile("DEV")
// public class DevelopmentProfileConfiguration implements ApplicationListener<ContextRefreshedEvent> {
// 
//     private final static Logger LOG = LoggerFactory.getLogger(DevelopmentProfileConfiguration.class);
// 
//     public final static Authority adminAuthority, userAuthority, developerAuthority;
//     public final static User alice, bob, charly;
// 
//     static {
//         LOG.info("Creating test data: authorities 'admin', 'user', 'developer'");
// 
//         adminAuthority = new Authority("admin", "The admin role");
//         userAuthority = new Authority("user", "The user role");
//         developerAuthority = new Authority("developer", "The developer role");
// 
//         LOG.info("Creating test data: users 'alice', 'bob', 'charly'");
//         alice = new User("alice");
//         alice.setUnencryptedPassword("alice");
//         alice.createRegistrationConfirmationToken();
//         alice.setEmail("alice@example.com");
//         alice.addAuthority(adminAuthority);
// 
//         bob = new User("bob");
//         bob.setUnencryptedPassword("bob");
//         bob.addAuthority(developerAuthority);
//         bob.addAuthority(userAuthority);
// 
//         charly = new User("charly");
//         charly.setLastLogin(LocalDateTime.now());
//         charly.setUnencryptedPassword("charly");
//     }
// 
//     @Autowired
//     private UserRepository userRepository;
// 
//     @Autowired
//     private AuthorityRepository authorityRepository;
// 
//     @Override
//     public void onApplicationEvent(ContextRefreshedEvent event) {
//         saveAuthorities();
//         saveUsers();
//     }
// 
//     private void saveAuthorities() {
//         authorityRepository.save(Arrays.asList(adminAuthority, userAuthority, developerAuthority));
//     }
// 
//     private void saveUsers() {
//         final List<User> users = Arrays.asList(alice, bob, charly);
//         userRepository.save(users);
//         LOG.info("Added users {}", users);
//     }
// }


import info.rolandkrueger.userservice.application.DevelopmentProfileConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
package info.rolandkrueger.userservice;


@SpringBootApplication
@PropertySource("userservice.properties")
public class UserMicroserviceApplication {

    public static void main(String[] args) {
        SpringApplication.run(
                new Object[]{
                        UserMicroserviceApplication.class,
// Path: service/src/main/java/info/rolandkrueger/userservice/application/DevelopmentProfileConfiguration.java
// @Component
// @Profile("DEV")
// public class DevelopmentProfileConfiguration implements ApplicationListener<ContextRefreshedEvent> {
// 
//     private final static Logger LOG = LoggerFactory.getLogger(DevelopmentProfileConfiguration.class);
// 
//     public final static Authority adminAuthority, userAuthority, developerAuthority;
//     public final static User alice, bob, charly;
// 
//     static {
//         LOG.info("Creating test data: authorities 'admin', 'user', 'developer'");
// 
//         adminAuthority = new Authority("admin", "The admin role");
//         userAuthority = new Authority("user", "The user role");
//         developerAuthority = new Authority("developer", "The developer role");
// 
//         LOG.info("Creating test data: users 'alice', 'bob', 'charly'");
//         alice = new User("alice");
//         alice.setUnencryptedPassword("alice");
//         alice.createRegistrationConfirmationToken();
//         alice.setEmail("alice@example.com");
//         alice.addAuthority(adminAuthority);
// 
//         bob = new User("bob");
//         bob.setUnencryptedPassword("bob");
//         bob.addAuthority(developerAuthority);
//         bob.addAuthority(userAuthority);
// 
//         charly = new User("charly");
//         charly.setLastLogin(LocalDateTime.now());
//         charly.setUnencryptedPassword("charly");
//     }
// 
//     @Autowired
//     private UserRepository userRepository;
// 
//     @Autowired
//     private AuthorityRepository authorityRepository;
// 
//     @Override
//     public void onApplicationEvent(ContextRefreshedEvent event) {
//         saveAuthorities();
//         saveUsers();
//     }
// 
//     private void saveAuthorities() {
//         authorityRepository.save(Arrays.asList(adminAuthority, userAuthority, developerAuthority));
//     }
// 
//     private void saveUsers() {
//         final List<User> users = Arrays.asList(alice, bob, charly);
//         userRepository.save(users);
//         LOG.info("Added users {}", users);
//     }
// }


// Path: service/src/main/java/info/rolandkrueger/userservice/UserMicroserviceApplication.java
import info.rolandkrueger.userservice.application.DevelopmentProfileConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;

package info.rolandkrueger.userservice;


@SpringBootApplication
@PropertySource("userservice.properties")
public class UserMicroserviceApplication {

    public static void main(String[] args) {
        SpringApplication.run(
                new Object[]{
                        UserMicroserviceApplication.class,
                        DevelopmentProfileConfiguration.class}