You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2017/11/14 17:50:14 UTC

[GitHub] gonzalad closed pull request #23: DBLoaderSpring propagates caller environment

gonzalad closed pull request #23: DBLoaderSpring propagates caller environment
URL: https://github.com/apache/cxf-fediz/pull/23
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
index 1d58a770..4cbd5d0a 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/DBLoaderSpring.java
@@ -25,11 +25,14 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
 import org.springframework.context.support.GenericXmlApplicationContext;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.Environment;
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
-public class DBLoaderSpring implements DBLoader {
+public class DBLoaderSpring implements DBLoader, EnvironmentAware {
 
     public static final String NAME = "SPRINGDBLOADER";
 
@@ -37,6 +40,7 @@
 
     private EntityManager em;
     private String resource;
+    private Environment environment;
 
     @PersistenceContext
     public void setEntityManager(EntityManager entityManager) {
@@ -57,6 +61,11 @@ public void setResource(String resource) {
     }
 
     @Override
+    public void setEnvironment(Environment environment) {
+        this.environment = environment;
+    }
+
+    @Override
     public void load() {
 
         GenericXmlApplicationContext ctx = null;
@@ -67,6 +76,9 @@ public void load() {
             }
 
             ctx = new GenericXmlApplicationContext();
+            if (environment instanceof ConfigurableEnvironment) {
+                ctx.setEnvironment((ConfigurableEnvironment) environment);
+            }
             ctx.load(resource);
             ctx.refresh();
             ctx.start();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services