isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject [isis] 01/02: ISIS-2854: further fixes for cyclic dependencies
Date Sun, 22 Aug 2021 11:42:15 GMT
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-2854-usermemento-refiner-circular-dependency
in repository https://gitbox.apache.org/repos/asf/isis.git

commit a16249115476906fdbbcca1c84d488538e335cce
Author: danhaywood <dan@haywood-associates.co.uk>
AuthorDate: Sun Aug 22 12:24:04 2021 +0100

    ISIS-2854: further fixes for cyclic dependencies
    
    InteractionService uses Provider of CommandPublisher; no need to inject AuthenticatoinManager;
can remove @Lazy of InteractionService for AuthenticationManager
---
 .../session/InteractionServiceDefault.java           | 20 +++++++++++++-------
 .../manager/AuthenticationManager.java               |  8 +++-----
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionServiceDefault.java
b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionServiceDefault.java
index 7d87030..b56003c 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionServiceDefault.java
@@ -31,6 +31,7 @@ import java.util.concurrent.Callable;
 import javax.annotation.Priority;
 import javax.inject.Inject;
 import javax.inject.Named;
+import javax.inject.Provider;
 
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@@ -66,7 +67,6 @@ import org.apache.isis.core.metamodel.services.publishing.CommandPublisher;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 import org.apache.isis.core.runtime.events.MetamodelEventService;
 import org.apache.isis.core.security.authentication.InteractionContextFactory;
-import org.apache.isis.core.security.authentication.manager.AuthenticationManager;
 
 import lombok.NonNull;
 import lombok.SneakyThrows;
@@ -90,28 +90,34 @@ implements
 
     final ThreadLocal<Stack<InteractionLayer>> interactionLayerStack = ThreadLocal.withInitial(Stack::new);
 
-    final AuthenticationManager authenticationManager;
     final MetamodelEventService runtimeEventService;
     final SpecificationLoader specificationLoader;
     final ServiceInjector serviceInjector;
 
     final InteractionAwareTransactionalBoundaryHandler txBoundaryHandler;
     final ClockService clockService;
-    final CommandPublisher commandPublisher;
+    final Provider<CommandPublisher> commandPublisherProvider;
     final List<TransactionBoundaryAware> transactionBoundaryAwareBeans;
     final ConfigurableBeanFactory beanFactory;
 
     final InteractionScopeLifecycleHandler interactionScopeLifecycleHandler;
 
     @Inject
-    public InteractionServiceDefault(AuthenticationManager authenticationManager, MetamodelEventService
runtimeEventService, SpecificationLoader specificationLoader, ServiceInjector serviceInjector,
InteractionAwareTransactionalBoundaryHandler txBoundaryHandler, ClockService clockService,
CommandPublisher commandPublisher, List<TransactionBoundaryAware> transactionBoundaryAwareBeans,
ConfigurableBeanFactory beanFactory) {
-        this.authenticationManager = authenticationManager;
+    public InteractionServiceDefault(
+            final MetamodelEventService runtimeEventService,
+            final SpecificationLoader specificationLoader,
+            final ServiceInjector serviceInjector,
+            final InteractionAwareTransactionalBoundaryHandler txBoundaryHandler,
+            final ClockService clockService,
+            final Provider<CommandPublisher> commandPublisherProvider,
+            final List<TransactionBoundaryAware> transactionBoundaryAwareBeans,
+            final ConfigurableBeanFactory beanFactory) {
         this.runtimeEventService = runtimeEventService;
         this.specificationLoader = specificationLoader;
         this.serviceInjector = serviceInjector;
         this.txBoundaryHandler = txBoundaryHandler;
         this.clockService = clockService;
-        this.commandPublisher = commandPublisher;
+        this.commandPublisherProvider = commandPublisherProvider;
         this.transactionBoundaryAwareBeans = transactionBoundaryAwareBeans;
         this.beanFactory = beanFactory;
 
@@ -416,7 +422,7 @@ implements
             command.updater().setCompletedAt(completedAt);
         }
 
-        commandPublisher.complete(command);
+        commandPublisherProvider.get().complete(command);
 
         interaction.clear();
     }
diff --git a/core/security/src/main/java/org/apache/isis/core/security/authentication/manager/AuthenticationManager.java
b/core/security/src/main/java/org/apache/isis/core/security/authentication/manager/AuthenticationManager.java
index 97fdb9f..2c069c2 100644
--- a/core/security/src/main/java/org/apache/isis/core/security/authentication/manager/AuthenticationManager.java
+++ b/core/security/src/main/java/org/apache/isis/core/security/authentication/manager/AuthenticationManager.java
@@ -22,13 +22,12 @@ package org.apache.isis.core.security.authentication.manager;
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.lang.Nullable;
 import javax.annotation.Priority;
 import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Lazy;
+import org.springframework.lang.Nullable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -68,11 +67,10 @@ public class AuthenticationManager {
     @Inject
     public AuthenticationManager(
             final List<Authenticator> authenticators,
-            // needs @Lazy due to circular provisioning dependency
-            final @Lazy InteractionService anonymousInteractionFactory,
+            final InteractionService interactionService,
             final RandomCodeGenerator randomCodeGenerator,
             final List<UserMementoRefiner> userMementoRefiners) {
-        this.interactionService = anonymousInteractionFactory;
+        this.interactionService = interactionService;
         this.randomCodeGenerator = randomCodeGenerator;
         this.authenticators = Can.ofCollection(authenticators);
         this.userMementoRefiners = userMementoRefiners;

Mime
View raw message