← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22330: JdbcTemplate. Replaced autowired with xml mapping. Preparing for multiple jdbc templates.

 

------------------------------------------------------------
revno: 22330
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 16:09:32 +0100
message:
  JdbcTemplate. Replaced autowired with xml mapping. Preparing for multiple jdbc templates.
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/partition/JdbcPartitionManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDimensionDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/command/code/SMSCodesDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/FavoriteDataItemUpgrader.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceCategoryOptionGroupTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2016-03-15 15:09:32 +0000
@@ -101,9 +101,13 @@
 
     private static final String COL_APPROVALLEVEL = "approvallevel";
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     @Autowired
     private StatementBuilder statementBuilder;
 

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2016-03-15 15:09:32 +0000
@@ -89,10 +89,14 @@
     private static final String QUERY_ERR_MSG = "Query failed, likely because the requested analytics table does not exist";
     private static final String ITEM_NAME_SEP = ": ";
     private static final String NA = "[N/A]";
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
-    
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     @Autowired
     private StatementBuilder statementBuilder;
     

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/partition/JdbcPartitionManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/partition/JdbcPartitionManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/partition/JdbcPartitionManager.java	2016-03-15 15:09:32 +0000
@@ -36,7 +36,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -49,10 +48,14 @@
     
     private Set<String> analyticsPartitions = null;
     private Set<String> analyticsEventPartitions = null;
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
-        
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+  
     @Override
     public Set<String> getAnalyticsPartitions()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2016-03-15 15:09:32 +0000
@@ -97,10 +97,14 @@
    
     @Autowired
     protected StatementBuilder statementBuilder;
-    
-    @Autowired
+
     protected JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // Abstract methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/resources/META-INF/dhis/beans.xml	2015-12-08 22:12:59 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 15:09:32 +0000
@@ -4,15 +4,25 @@
 
   <!-- Table -->
 
-  <bean id="org.hisp.dhis.analytics.AnalyticsTableManager" class="org.hisp.dhis.analytics.table.JdbcAnalyticsTableManager" />
-  
-  <bean id="org.hisp.dhis.analytics.CompletenessTableManager" class="org.hisp.dhis.analytics.table.JdbcCompletenessTableManager" />
-  
-  <bean id="org.hisp.dhis.analytics.CompletenessTargetTableManager" class="org.hisp.dhis.analytics.table.JdbcCompletenessTargetTableManager" />
-  
-  <bean id="org.hisp.dhis.analytics.OrgUnitTargetTableManager" class="org.hisp.dhis.analytics.table.JdbcOrgUnitTargetTableManager" />
-  
-  <bean id="org.hisp.dhis.analytics.EventAnalyticsTableManager" class="org.hisp.dhis.analytics.table.JdbcEventAnalyticsTableManager" />
+  <bean id="org.hisp.dhis.analytics.AnalyticsTableManager" class="org.hisp.dhis.analytics.table.JdbcAnalyticsTableManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.analytics.CompletenessTableManager" class="org.hisp.dhis.analytics.table.JdbcCompletenessTableManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.analytics.CompletenessTargetTableManager" class="org.hisp.dhis.analytics.table.JdbcCompletenessTargetTableManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.analytics.OrgUnitTargetTableManager" class="org.hisp.dhis.analytics.table.JdbcOrgUnitTargetTableManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.analytics.EventAnalyticsTableManager" class="org.hisp.dhis.analytics.table.JdbcEventAnalyticsTableManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
   
   <bean id="org.hisp.dhis.analytics.AnalyticsTableService" class="org.hisp.dhis.analytics.table.DefaultAnalyticsTableService">
     <property name="tableManager" ref="org.hisp.dhis.analytics.AnalyticsTableManager" />
@@ -34,11 +44,15 @@
     <property name="tableManager" ref="org.hisp.dhis.analytics.EventAnalyticsTableManager" />
   </bean>
   
-  <bean id="org.hisp.dhis.analytics.partition.PartitionManager" class="org.hisp.dhis.analytics.partition.JdbcPartitionManager" />
+  <bean id="org.hisp.dhis.analytics.partition.PartitionManager" class="org.hisp.dhis.analytics.partition.JdbcPartitionManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
     
   <!-- Routine analytics -->
   
-  <bean id="org.hisp.dhis.analytics.AnalyticsManager" class="org.hisp.dhis.analytics.data.JdbcAnalyticsManager" />
+  <bean id="org.hisp.dhis.analytics.AnalyticsManager" class="org.hisp.dhis.analytics.data.JdbcAnalyticsManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
   
   <bean id="org.hisp.dhis.analytics.DataQueryService" class="org.hisp.dhis.analytics.data.DefaultDataQueryService" />
   
@@ -50,7 +64,9 @@
 
   <!-- Event analytics -->
 
-  <bean id="org.hisp.dhis.analytics.event.EventAnalyticsManager" class="org.hisp.dhis.analytics.event.data.JdbcEventAnalyticsManager"/>
+  <bean id="org.hisp.dhis.analytics.event.EventAnalyticsManager" class="org.hisp.dhis.analytics.event.data.JdbcEventAnalyticsManager">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
   <bean id="org.hisp.dhis.analytics.event.EventDataQueryService" class="org.hisp.dhis.analytics.event.data.DefaultEventDataQueryService" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java	2016-03-14 08:58:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java	2016-03-15 15:09:32 +0000
@@ -32,7 +32,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
 import org.hisp.dhis.system.util.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
@@ -67,9 +66,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // Execute
     // -------------------------------------------------------------------------
@@ -85,7 +88,7 @@
                 log.debug( "Checking table: " + table );
 
                 int count = 0;
-
+                
                 SqlRowSet resultSet = jdbcTemplate.queryForRowSet( "SELECT * from " + table + " WHERE uid IS NULL" );
 
                 while ( resultSet.next() )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDimensionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDimensionDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDimensionDeletionHandler.java	2016-03-15 15:09:32 +0000
@@ -29,7 +29,6 @@
  */
 
 import org.hisp.dhis.system.deletion.DeletionHandler;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -38,9 +37,13 @@
 public class DataElementCategoryDimensionDeletionHandler
     extends DeletionHandler
 {
-    @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2016-03-15 15:09:32 +0000
@@ -49,9 +49,13 @@
     @Autowired
     private DataElementCategoryService categoryService;
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
-    
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/command/code/SMSCodesDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/command/code/SMSCodesDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/command/code/SMSCodesDeletionHandler.java	2016-03-15 15:09:32 +0000
@@ -30,7 +30,6 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.system.deletion.DeletionHandler;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -41,7 +40,6 @@
 {
     private JdbcTemplate jdbcTemplate;
 
-    @Autowired
     public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
     {
         this.jdbcTemplate = jdbcTemplate;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/FavoriteDataItemUpgrader.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/FavoriteDataItemUpgrader.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/FavoriteDataItemUpgrader.java	2016-03-15 15:09:32 +0000
@@ -52,10 +52,14 @@
     extends AbstractStartupRoutine
 {
     private static final Log log = LogFactory.getLog( FavoriteDataItemUpgrader.class );
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
-    
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     @Autowired
     private IdentifiableObjectManager idObjectManager;
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2016-03-15 15:09:32 +0000
@@ -31,7 +31,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.system.startup.AbstractStartupRoutine;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -46,9 +45,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
-    
+
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // StartupRoutine implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java	2016-03-15 15:09:32 +0000
@@ -104,6 +104,8 @@
 
     private Integer cpuCores;
 
+    private boolean spatialSupport;
+    
     private String systemId;
 
     public SystemInfo instance()
@@ -131,6 +133,7 @@
         this.databaseInfo = null;
         this.memoryInfo = null;
         this.cpuCores = null;
+        this.spatialSupport = false;
         this.systemId = null;
     }
     
@@ -428,6 +431,18 @@
 
     @JsonProperty
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public boolean isSpatialSupport()
+    {
+        return spatialSupport;
+    }
+
+    public void setSpatialSupport( boolean spatialSupport )
+    {
+        this.spatialSupport = spatialSupport;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getSystemId()
     {
         return systemId;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceDeletionHandler.java	2016-03-15 15:09:32 +0000
@@ -31,7 +31,6 @@
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.deletion.DeletionHandler;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -50,10 +49,14 @@
     {
         this.instanceService = instanceService;
     }
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2016-03-13 07:34:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2016-03-15 15:09:32 +0000
@@ -70,9 +70,13 @@
         this.statementManager = statementManager;
     }
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     @Autowired
     private StatementBuilder statementBuilder;
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java	2016-03-15 15:09:32 +0000
@@ -47,10 +47,14 @@
 
     @Autowired
     private IdentifiableObjectManager idObjectManager;
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 09:34:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 15:09:32 +0000
@@ -1454,6 +1454,7 @@
     <property name="name" value="IdentityPopulator" />
     <property name="runlevel" value="4" />
     <property name="skipInTests" value="true" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
     <property name="tables">
       <list>
         <value>constant</value>
@@ -1514,6 +1515,7 @@
   <bean id="org.hisp.dhis.startup.TableCreator" class="org.hisp.dhis.startup.TableCreator">
     <property name="name" value="TableCreator" />
     <property name="runlevel" value="5" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
   <bean id="org.hisp.dhis.startup.TableAlteror" class="org.hisp.dhis.startup.TableAlteror">
@@ -1527,12 +1529,14 @@
     <property name="name" value="TrackedEntityTableAlteror" />
     <property name="runlevel" value="7" />
     <property name="skipInTests" value="true" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
   <bean id="org.hisp.dhis.startup.FavoriteDataItemUpgrader" class="org.hisp.dhis.startup.FavoriteDataItemUpgrader">
     <property name="name" value="FavoriteDataItemUpgrader" />
     <property name="runlevel" value="9" />
     <property name="skipInTests" value="true" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
   <bean id="org.hisp.dhis.dataentryform.DataEntryFormUpgrader" class="org.hisp.dhis.dataentryform.DataEntryFormUpgrader">
@@ -1589,7 +1593,9 @@
     <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementDeletionHandler" class="org.hisp.dhis.dataelement.DataElementDeletionHandler" />
+  <bean id="org.hisp.dhis.dataelement.DataElementDeletionHandler" class="org.hisp.dhis.dataelement.DataElementDeletionHandler">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
   <bean id="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler" class="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler" />
 
@@ -1608,7 +1614,9 @@
   </bean>
 
   <bean id="org.hisp.dhis.dataelement.DataElementCategoryDimensionDeletionHandler"
-    class="org.hisp.dhis.dataelement.DataElementCategoryDimensionDeletionHandler" />
+    class="org.hisp.dhis.dataelement.DataElementCategoryDimensionDeletionHandler">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
   <bean id="org.hisp.dhis.dataset.DataSetDeletionHandler" class="org.hisp.dhis.dataset.DataSetDeletionHandler" />
 
@@ -1661,7 +1669,9 @@
 
   <bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler" />
 
-  <bean id="org.hisp.dhis.user.UserGroupDeletionHandler" class="org.hisp.dhis.user.UserGroupDeletionHandler" />
+  <bean id="org.hisp.dhis.user.UserGroupDeletionHandler" class="org.hisp.dhis.user.UserGroupDeletionHandler">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
   <bean id="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler" class="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler">
     <property name="userService" ref="org.hisp.dhis.user.UserService" />
@@ -1730,6 +1740,7 @@
   <bean id="org.hisp.dhis.trackedentity.TrackedEntityInstanceDeletionHandler"
     class="org.hisp.dhis.trackedentity.TrackedEntityInstanceDeletionHandler">
     <property name="instanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
   <bean id="org.hisp.dhis.program.ProgramStageDataElementDeletionHandler"
@@ -1795,7 +1806,9 @@
     class="org.hisp.dhis.sms.command.SMSCommandDeletionHandler" />
 
   <bean id="org.hisp.dhis.sms.command.code.SMSCodesDeletionHandler"
-    class="org.hisp.dhis.sms.command.code.SMSCodesDeletionHandler" />
+    class="org.hisp.dhis.sms.command.code.SMSCodesDeletionHandler">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>    
 
   <!-- AOP definitions -->
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceCategoryOptionGroupTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceCategoryOptionGroupTest.java	2016-01-11 03:14:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceCategoryOptionGroupTest.java	2016-03-15 15:09:32 +0000
@@ -42,6 +42,8 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.annotation.Resource;
+
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.CodeGenerator;
@@ -129,7 +131,7 @@
     @Autowired
     protected CurrentUserService currentUserService;
 
-    @Autowired
+    @Resource( name = "jdbcTemplate" )
     private JdbcTemplate jdbcTemplate;
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java	2016-01-11 03:14:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java	2016-03-15 15:09:32 +0000
@@ -40,6 +40,8 @@
 import java.util.Date;
 import java.util.Set;
 
+import javax.annotation.Resource;
+
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataapproval.exceptions.DataMayNotBeApprovedException;
@@ -108,7 +110,7 @@
     @Autowired
     protected CurrentUserService currentUserService;
 
-    @Autowired
+    @Resource( name = "jdbcTemplate" )
     private JdbcTemplate jdbcTemplate;
     
     // -------------------------------------------------------------------------
@@ -318,17 +320,17 @@
         String uidF = organisationUnitF.getUid();
 
         jdbcTemplate.execute(
-                "CREATE TABLE _orgunitstructure "+
-                "(" +
-                "  organisationunitid integer NOT NULL, " +
-                "  organisationunituid character(11) NOT NULL, " +
-                "  level integer, " +
-                "  idlevel1 integer, " +
-                "  idlevel2 integer, " +
-                "  idlevel3 integer, " +
-                "  idlevel4 integer, " +
-                "  CONSTRAINT _orgunitstructure_pkey PRIMARY KEY (organisationunitid)" +
-                ");" );
+            "CREATE TABLE _orgunitstructure "+
+            "(" +
+            "  organisationunitid integer NOT NULL, " +
+            "  organisationunituid character(11) NOT NULL, " +
+            "  level integer, " +
+            "  idlevel1 integer, " +
+            "  idlevel2 integer, " +
+            "  idlevel3 integer, " +
+            "  idlevel4 integer, " +
+            "  CONSTRAINT _orgunitstructure_pkey PRIMARY KEY (organisationunitid)" +
+            ");" );
 
         jdbcTemplate.execute( "INSERT INTO _orgunitstructure VALUES (" + idA + ", '" + uidA + "', 1, " + idA + ", null, null, null);" );
         jdbcTemplate.execute( "INSERT INTO _orgunitstructure VALUES (" + idB + ", '" + uidB + "', 2, " + idA + ", " + idB + ", null, null);" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2016-03-08 17:02:03 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2016-03-15 15:09:32 +0000
@@ -40,6 +40,8 @@
 import java.util.Date;
 import java.util.List;
 
+import javax.annotation.Resource;
+
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.dataapproval.DataApproval;
 import org.hisp.dhis.dataapproval.DataApprovalLevel;
@@ -85,7 +87,7 @@
     private OrganisationUnit unitE;
     private OrganisationUnit unitF;
 
-    DataElementCategoryOptionCombo attributeOptionCombo;
+    private DataElementCategoryOptionCombo attributeOptionCombo;
 
     private CurrentUserService mockCurrentUserService;
 
@@ -119,7 +121,7 @@
     @Autowired
     private DataApprovalWorkflowService workflowService;
 
-    @Autowired
+    @Resource( name = "jdbcTemplate" )
     private JdbcTemplate jdbcTemplate;
 
     @Autowired
@@ -165,15 +167,17 @@
         user.setSurname( "Doe" );
         userService.addUser( mockCurrentUserService.getCurrentUser() );
 
+        // TODO remove dependency on resource tables in approval and remove this
+        
         jdbcTemplate.execute(
             "CREATE TABLE _orgunitstructure " +
-                "(" +
-                "  organisationunitid integer NOT NULL, " +
-                "  organisationunituid character(11) NOT NULL, " +
-                "  level integer, " +
-                "  idlevel1 integer, " +
-                "  CONSTRAINT _orgunitstructure_pkey PRIMARY KEY (organisationunitid)" +
-                ");" );
+            "(" +
+            "  organisationunitid integer NOT NULL, " +
+            "  organisationunituid character(11) NOT NULL, " +
+            "  level integer, " +
+            "  idlevel1 integer, " +
+            "  CONSTRAINT _orgunitstructure_pkey PRIMARY KEY (organisationunitid)" +
+            ");" );
 
         jdbcTemplate.execute( "INSERT INTO _orgunitstructure VALUES (" + unitA.getId() + ", '" + unitA.getUid() + "', 1, " + unitA.getId() + ");" );
         jdbcTemplate.execute( "INSERT INTO _orgunitstructure VALUES (" + unitB.getId() + ", '" + unitB.getUid() + "', 2, " + unitB.getId() + ");" );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java	2016-02-05 12:16:44 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java	2016-03-15 15:09:32 +0000
@@ -42,7 +42,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.util.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowCallbackHandler;
 
@@ -69,9 +68,13 @@
 
     private static final char CSV_DELIM = ',';
 
-    @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     //--------------------------------------------------------------------------
     // DataValueSetStore implementation
     //--------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2016-03-11 16:19:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2016-03-15 15:09:32 +0000
@@ -47,7 +47,6 @@
 import org.hisp.dhis.query.Order;
 import org.hisp.dhis.system.util.DateUtils;
 import org.hisp.dhis.util.ObjectUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
@@ -88,10 +87,14 @@
         put( "lastUpdated", "psi_lastupdated" ).
         put( "completedBy", "psi_completedby" ).
         put( "completedDate", "psi_completeddate" ).build();
-    
-    @Autowired
+
     private JdbcTemplate jdbcTemplate;
 
+    public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+    {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 10:24:55 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 15:09:32 +0000
@@ -42,9 +42,13 @@
     class="org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService" />
 
   <bean id="org.hisp.dhis.dxf2.datavalueset.DataValueSetStore"
-    class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" />
+    class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
-  <bean id="org.hisp.dhis.dxf2.events.event.EventStore" class="org.hisp.dhis.dxf2.events.event.JdbcEventStore" />
+  <bean id="org.hisp.dhis.dxf2.events.event.EventStore" class="org.hisp.dhis.dxf2.events.event.JdbcEventStore">
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+  </bean>
 
   <bean id="org.hisp.dhis.dxf2.events.event.EventService" class="org.hisp.dhis.dxf2.events.event.JacksonEventService" scope="prototype">
     <aop:scoped-proxy proxy-target-class="false" />

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 09:34:18 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2016-03-15 15:09:32 +0000
@@ -149,6 +149,7 @@
     <property name="name" value="ReportingIdentityPopulator" />
     <property name="runlevel" value="4" />
     <property name="skipInTests" value="true" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
     <property name="tables">
       <list>
         <value>reporttable</value>