tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject incubator-tamaya git commit: TAMAYA-304 - If no services came back, use the class's class loader to discover services.
Date Thu, 21 Sep 2017 03:01:22 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/java8 6010c606c -> 54f6b1c87


TAMAYA-304 - If no services came back, use the class's class loader to discover services.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/54f6b1c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/54f6b1c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/54f6b1c8

Branch: refs/heads/java8
Commit: 54f6b1c87c5ae50dc5604ca51d4a58d5a93830dc
Parents: 6010c60
Author: John D. Ament <john.d.ament@gmail.com>
Authored: Wed Sep 20 23:01:16 2017 -0400
Committer: John D. Ament <john.d.ament@gmail.com>
Committed: Wed Sep 20 23:01:16 2017 -0400

----------------------------------------------------------------------
 .../org/apache/tamaya/core/internal/DefaultServiceContext.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/54f6b1c8/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
index b4a059c..7146ccf 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
@@ -20,7 +20,6 @@ package org.apache.tamaya.core.internal;
 
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.spi.ServiceContext;
-import org.osgi.service.component.annotations.Component;
 
 import javax.annotation.Priority;
 import java.io.IOException;
@@ -96,6 +95,11 @@ public final class DefaultServiceContext implements ServiceContext {
             for (T t : ServiceLoader.load(serviceType)) {
                 services.add(t);
             }
+            if(services.isEmpty()) {
+                for (T t : ServiceLoader.load(serviceType, serviceType.getClassLoader()))
{
+                    services.add(t);
+                }
+            }
             Collections.sort(services, PriorityServiceComparator.getInstance());
             services = Collections.unmodifiableList(services);
         } catch (ServiceConfigurationError e) {


Mime
View raw message