You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/12/17 16:38:35 UTC

[isis] branch master updated: ISIS-2158: revert that @Service classes get added to MM

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new b95717f  ISIS-2158: revert that @Service classes get added to MM
b95717f is described below

commit b95717f91d313f6fcdc0f91f66408b320eee09d2
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Dec 17 17:38:24 2019 +0100

    ISIS-2158: revert that @Service classes get added to MM
    
    only use-case this is ever required is for async action invocation,
    that is when running actions in the background using the new
    wrapper/asnyc feature;
    
    see 'EventSubscriber' from the demo-app as an example
---
 .../java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java    | 3 +--
 .../demo/src/main/java/demoapp/dom/events/EventSubscriber.java     | 7 ++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java b/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
index f67b36e..34855cd 100644
--- a/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
+++ b/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
@@ -30,7 +30,6 @@ import java.util.Set;
 import javax.enterprise.inject.Vetoed;
 
 import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
 
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.DomainService;
@@ -127,7 +126,7 @@ public final class IsisBeanTypeRegistry implements IsisComponentScanInterceptor,
         
         val isManagedBeanToBeInspected = beanSort.isManagedBean() 
                 && (findNearestAnnotation(type, DomainService.class).isPresent()
-                        || findNearestAnnotation(type, Service.class).isPresent()
+                        // || findNearestAnnotation(type, Service.class).isPresent() 
                         );
         
         val isManagedObjectToBeInspected = !beanSort.isManagedBean() 
diff --git a/examples/demo/src/main/java/demoapp/dom/events/EventSubscriber.java b/examples/demo/src/main/java/demoapp/dom/events/EventSubscriber.java
index e7f684e..bec5697 100644
--- a/examples/demo/src/main/java/demoapp/dom/events/EventSubscriber.java
+++ b/examples/demo/src/main/java/demoapp/dom/events/EventSubscriber.java
@@ -26,6 +26,8 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.event.EventListener;
 import org.springframework.stereotype.Service;
 
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.DomainService;
 import org.apache.isis.applib.events.domain.AbstractDomainEvent;
 import org.apache.isis.applib.services.eventbus.EventBusService;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
@@ -35,6 +37,7 @@ import static demoapp.utils.DemoUtils.emphasize;
 import demoapp.dom.events.EventLogMenu.EventTestProgrammaticEvent;
 import lombok.extern.log4j.Log4j2;
 
+@DomainService // allows async invocation of the storeEvent(...) Action
 @Service
 @Named("demoapp.eventSubscriber")
 @Qualifier("demo")
@@ -62,12 +65,14 @@ public class EventSubscriber {
 
         log.info(emphasize("DomainEvent: "+ev.getClass().getName()));
         
-        // store in event log
+        // store in event log, by calling the storeEvent(...) Action
         wrapper.async(this)
         .run(EventSubscriber::storeEvent, ev);
 
     }
 
+    
+    @Action // allows async invocation 
     public void storeEvent(EventTestProgrammaticEvent ev) {
         eventLogRepository.add(EventLogEntry.of(ev));
     }