Skip to content

Commit

Permalink
UP-5002: Must make certain that the PersonFactory bean is not lazy-lo…
Browse files Browse the repository at this point in the history
…aded in Spring (which is a danger in Import/Export from the CLI)
  • Loading branch information
drewwills committed Mar 12, 2018
1 parent 18102cf commit 82180eb
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import javax.annotation.PostConstruct;
import org.apereo.portal.security.provider.PersonImpl;
import org.apereo.portal.security.provider.RestrictedPerson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
Expand All @@ -43,16 +46,20 @@
* </ol>
*/
@Component
@Lazy(false) // Force this bean to load in Import/Export via the CLI
public class PersonFactory {

private String guestUsernamesProperty = "guest"; // default; for unit tests

private static List<String> guestUsernames = null;

private final Logger logger = LoggerFactory.getLogger(getClass());

@PostConstruct
public void init() {
guestUsernames =
Collections.unmodifiableList(Arrays.asList(guestUsernamesProperty.split(",")));
logger.info("Found the following guest usernames: {}", guestUsernames);
}

/**
Expand Down

0 comments on commit 82180eb

Please sign in to comment.