syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreapatrice...@apache.org
Subject [syncope] branch 2_1_X updated: [SYNCOPE-1418] Added harmless spring lazy loading on some shared DAO beans
Date Fri, 21 Dec 2018 09:00:28 GMT
This is an automated email from the ASF dual-hosted git repository.

andreapatricelli pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new 7e4e6db  [SYNCOPE-1418] Added harmless spring lazy loading on some shared DAO beans
7e4e6db is described below

commit 7e4e6db1605ab19e7155364e1dcff130fbb7dbc9
Author: Andrea Patricelli <andreapatricelli@apache.org>
AuthorDate: Fri Dec 21 09:09:34 2018 +0100

    [SYNCOPE-1418] Added harmless spring lazy loading on some shared DAO beans
---
 .../org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java   | 4 ++++
 .../org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java     | 3 +++
 .../java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java | 2 ++
 .../org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java  | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index 531607b..7cd75d4 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -61,6 +61,7 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -73,12 +74,15 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends
AbstractDAO<A> im
     protected ApplicationEventPublisher publisher;
 
     @Autowired
+    @Lazy
     protected PlainSchemaDAO plainSchemaDAO;
 
     @Autowired
+    @Lazy
     protected DerSchemaDAO derSchemaDAO;
 
     @Autowired
+    @Lazy
     protected DynRealmDAO dynRealmDAO;
 
     private AnyUtils anyUtils;
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 495585f..c1cb136 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -38,15 +38,18 @@ import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullPolicy;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushCorrelationRuleEntity;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushPolicy;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Repository;
 
 @Repository
 public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
 
     @Autowired
+    @Lazy
     private RealmDAO realmDAO;
 
     @Autowired
+    @Lazy
     private ExternalResourceDAO resourceDAO;
 
     private <T extends Policy> Class<? extends AbstractPolicy> getEntityReference(final
Class<T> reference) {
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index b2ad416..d2ed275 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -38,6 +38,7 @@ import org.apache.syncope.core.persistence.api.entity.policy.ProvisioningPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class JPARealmDAO extends AbstractDAO<Realm> implements RealmDAO {
 
     @Autowired
+    @Lazy
     private RoleDAO roleDAO;
 
     @Override
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
index 1d3043b..4cd1aed 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAVirSchemaDAO.java
@@ -39,12 +39,14 @@ import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResour
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAMapping;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAProvision;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Repository;
 
 @Repository
 public class JPAVirSchemaDAO extends AbstractDAO<VirSchema> implements VirSchemaDAO
{
 
     @Autowired
+    @Lazy
     private ExternalResourceDAO resourceDAO;
 
     @Override


Mime
View raw message