From 1b1795f53ab0584ed749517a4e06bce84680e167 Mon Sep 17 00:00:00 2001 From: Sean Flanigan Date: Fri, 16 Feb 2018 11:21:25 +1000 Subject: [PATCH] Simplify CurrentUserImpl --- .../org/zanata/seam/security/CurrentUserImpl.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/server/services/src/main/java/org/zanata/seam/security/CurrentUserImpl.java b/server/services/src/main/java/org/zanata/seam/security/CurrentUserImpl.java index 738f5264a1..75aacc9112 100644 --- a/server/services/src/main/java/org/zanata/seam/security/CurrentUserImpl.java +++ b/server/services/src/main/java/org/zanata/seam/security/CurrentUserImpl.java @@ -21,9 +21,7 @@ package org.zanata.seam.security; import javax.annotation.Nullable; -import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; -import javax.enterprise.inject.Instance; import javax.inject.Inject; import org.zanata.model.HAccount; @@ -38,17 +36,11 @@ public class CurrentUserImpl implements CurrentUser { @SuppressFBWarnings("SE_BAD_FIELD") @Inject @Authenticated - private Instance accountInstance; + // Note: the Dependent-scoped HAccount bean is bound to the lifecycle of + // this (RequestScoped) bean. + // Ref: https://rmannibucau.wordpress.com/2015/03/02/cdi-and-instance-3-pitfalls-you-need-to-know/ private HAccount account; - @PostConstruct - private void resolve() { - // Note: the Dependent-scoped HAccount will be destroyed when this - // (RequestScoped) bean is destroyed. - // Ref: https://rmannibucau.wordpress.com/2015/03/02/cdi-and-instance-3-pitfalls-you-need-to-know/ - account = accountInstance.get(); - } - /** * Note that the HAccount will be null if the user is not authenticated. */