@Transactional
	public void onApplicationEvent(ContextRefreshedEvent event) {

		if (installDefaultAdminUser && defaultAdminUsername != null
				&& defaultAdminPassword != null) {

			User admin = userService.findByUsername("admin");

			if (admin == null) {

				admin = new User();
				admin.setUsername(defaultAdminUsername);
				admin.setPassword(defaultAdminPassword);

				Group userGroup = new Group();
				userGroup.setName("ROLE_USER");
				userService.installNewGroup(userGroup);

				Group adminGroup = new Group();
				adminGroup.setName("ROLE_ADMIN");
				userService.installNewGroup(adminGroup);

				admin.setGroups(new ArrayList<Group>(2));
				admin.getGroups().add(userGroup);
				admin.getGroups().add(adminGroup);

				userService.installNewUser(admin);
				
				User user = new User();
				
				user.setUsername("user");
				user.setPassword(defaultAdminPassword);
				
				user.setGroups(new ArrayList<Group>(1));
				user.getGroups().add(userGroup);
				userService.installNewUser(user);
				
				log.info("Installed default admin account with username="
						+ defaultAdminUsername);
			}
		}
	}