ATLAS-1198: Spring Framework (v4 with Spring security) over Guice
diff --git a/addons/falcon-bridge/pom.xml b/addons/falcon-bridge/pom.xml
index aa55bd6..287b8e9 100644
--- a/addons/falcon-bridge/pom.xml
+++ b/addons/falcon-bridge/pom.xml
@@ -201,10 +201,6 @@
                                             <version>${scala.version}</version>
                                         </artifactItem>
                                         <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-multibindings</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
                                             <groupId>org.apache.kafka</groupId>
                                             <artifactId>kafka_${scala.binary.version}</artifactId>
                                             <version>${kafka.version}</version>
diff --git a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
index 842b2ce..3b384f8 100644
--- a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
+++ b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
@@ -19,15 +19,12 @@
 package org.apache.atlas.falcon.hook;
 
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.falcon.bridge.FalconBridge;
 import org.apache.atlas.falcon.event.FalconEvent;
 import org.apache.atlas.falcon.publisher.FalconEventPublisher;
 import org.apache.atlas.hook.AtlasHook;
-import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.notification.hook.HookNotification;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.falcon.entity.store.ConfigurationStore;
@@ -112,8 +109,7 @@
 
             STORE = ConfigurationStore.get();
 
-            Injector injector = Guice.createInjector(new NotificationModule());
-            notifInterface = injector.getInstance(NotificationInterface.class);
+            notificationInterface = NotificationProvider.get();
 
         } catch (Exception e) {
             LOG.error("Caught exception initializing the falcon hook.", e);
diff --git a/addons/hive-bridge/pom.xml b/addons/hive-bridge/pom.xml
index c8dee7c..983a04f 100755
--- a/addons/hive-bridge/pom.xml
+++ b/addons/hive-bridge/pom.xml
@@ -249,10 +249,6 @@
                                             <version>${scala.version}</version>
                                         </artifactItem>
                                         <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-multibindings</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
                                             <groupId>org.apache.kafka</groupId>
                                             <artifactId>kafka_${scala.binary.version}</artifactId>
                                             <version>${kafka.version}</version>
diff --git a/addons/sqoop-bridge/pom.xml b/addons/sqoop-bridge/pom.xml
index 805d40d..d52167b 100644
--- a/addons/sqoop-bridge/pom.xml
+++ b/addons/sqoop-bridge/pom.xml
@@ -261,10 +261,6 @@
                                             <version>${scala.version}</version>
                                         </artifactItem>
                                         <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-multibindings</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
                                             <groupId>org.apache.kafka</groupId>
                                             <artifactId>kafka_${scala.binary.version}</artifactId>
                                             <version>${kafka.version}</version>
diff --git a/addons/storm-bridge/pom.xml b/addons/storm-bridge/pom.xml
index 527fe32..5fb1be0 100644
--- a/addons/storm-bridge/pom.xml
+++ b/addons/storm-bridge/pom.xml
@@ -35,17 +35,6 @@
     </properties>
 
     <dependencies>
-        <!-- Logging -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-        </dependency>
-
         <!-- apache atlas core dependencies -->
         <dependency>
             <groupId>org.apache.atlas</groupId>
@@ -231,22 +220,6 @@
                                             <version>${scala.version}</version>
                                         </artifactItem>
                                         <artifactItem>
-                                            <groupId>com.google.inject</groupId>
-                                            <artifactId>guice</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-multibindings</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-servlet</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
-                                            <groupId>com.google.inject.extensions</groupId>
-                                            <artifactId>guice-throwingproviders</artifactId>
-                                        </artifactItem>
-                                        <artifactItem>
                                             <groupId>org.apache.kafka</groupId>
                                             <artifactId>kafka_${scala.binary.version}</artifactId>
                                             <version>${kafka.version}</version>
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
index 9b405cc..7022081 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
@@ -17,15 +17,14 @@
  */
 package org.apache.atlas.authorize;
 
-import java.util.Date;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.atlas.authorize.simple.AtlasAuthorizationUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.Set;
+
 public class AtlasAccessRequest {
 
     private static Logger LOG = LoggerFactory.getLogger(AtlasAccessRequest.class);
@@ -39,7 +38,8 @@
     private String clientIPAddress = null;
 
     public AtlasAccessRequest(HttpServletRequest request, String user, Set<String> userGroups) {
-        this(AtlasAuthorizationUtils.getAtlasResourceType(request.getServletPath()), "*", AtlasAuthorizationUtils
+        // Spring Security 4 Change => request.getServletPath() -> request.getPathInfo()
+        this(AtlasAuthorizationUtils.getAtlasResourceType(request.getPathInfo()), "*", AtlasAuthorizationUtils
             .getAtlasAction(request.getMethod()), user, userGroups,AtlasAuthorizationUtils.getRequestIpAddress(request));
     }
 
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 5f7bb8e..2828bed 100755
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -114,21 +114,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-throwingproviders</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-multibindings</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>com.googlecode.json-simple</groupId>
             <artifactId>json-simple</artifactId>
         </dependency>
diff --git a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
index 3bdddd9..98da51e 100644
--- a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
@@ -17,19 +17,16 @@
  */
 package org.apache.atlas;
 
-import static org.apache.atlas.security.SecurityProperties.TLS_ENABLED;
-
-import java.io.IOException;
-import java.net.ConnectException;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
+import com.google.common.annotations.VisibleForTesting;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientHandlerException;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 import org.apache.atlas.model.metrics.AtlasMetrics;
 import org.apache.atlas.security.SecureClientUtils;
 import org.apache.atlas.utils.AuthenticationUtil;
@@ -41,16 +38,17 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.atlas.security.SecurityProperties.TLS_ENABLED;
 
 public abstract class AtlasBaseClient {
     public static final String BASE_URI = "api/atlas/";
@@ -410,7 +408,7 @@
         for (int i = 0; i < getNumberOfRetries(); i++) {
             WebResource resource = resourceCreator.createResource();
             try {
-                LOG.debug("Using resource {} for {} times", resource.getURI(), i);
+                LOG.debug("Using resource {} for {} times", resource.getURI(), i + 1);
                 return callAPIWithResource(api, resource, requestObject, JSONObject.class);
             } catch (ClientHandlerException che) {
                 if (i == (getNumberOfRetries() - 1)) {
diff --git a/client/src/main/java/org/apache/atlas/AtlasClient.java b/client/src/main/java/org/apache/atlas/AtlasClient.java
index f503ade..ec482da 100755
--- a/client/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClient.java
@@ -20,9 +20,8 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableSet;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
 import com.sun.jersey.api.client.WebResource;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
@@ -36,10 +35,6 @@
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -49,18 +44,10 @@
 import javax.ws.rs.HttpMethod;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
 
 /**
  * Client for metadata.
@@ -255,76 +242,6 @@
         }
     }
 
-    @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
-    @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-    @JsonIgnoreProperties(ignoreUnknown=true)
-    @XmlRootElement
-    @XmlAccessorType(XmlAccessType.PROPERTY)
-    public static class EntityResult {
-        private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
-        public static final String OP_CREATED = "created";
-        public static final String OP_UPDATED = "updated";
-        public static final String OP_DELETED = "deleted";
-
-        Map<String, List<String>> entities = new HashMap<>();
-
-        public EntityResult() {
-            //For gson
-        }
-
-        public EntityResult(List<String> created, List<String> updated, List<String> deleted) {
-            set(OP_CREATED, created);
-            set(OP_UPDATED, updated);
-            set(OP_DELETED, deleted);
-        }
-
-        public void set(String type, List<String> list) {
-            if (list != null && list.size() > 0) {
-                entities.put(type, list);
-            }
-        }
-
-        private List<String> get(String type) {
-            List<String> list = entities.get(type);
-            if (list == null) {
-                list = new ArrayList<>();
-            }
-            return list;
-        }
-
-        public Map<String, List<String>> getEntities(){
-            return entities;
-        }
-
-        public void setEntities(Map<String, List<String>> entities){
-            this.entities = entities;
-        }
-
-        @JsonIgnore
-        public List<String> getCreatedEntities() {
-            return get(OP_CREATED);
-        }
-
-        @JsonIgnore
-        public List<String> getUpdateEntities() {
-            return get(OP_UPDATED);
-        }
-
-
-        @JsonIgnore
-        public List<String> getDeletedEntities() {
-            return get(OP_DELETED);
-        }
-
-        @Override
-        public String toString() { return gson.toJson(this); }
-
-        public static EntityResult fromString(String json) throws AtlasServiceException {
-            return gson.fromJson(json, EntityResult.class);
-        }
-    }
-
     /**
      * Register the given type(meta model)
      * @param typeAsJson type definition a jaon
@@ -470,11 +387,6 @@
             JSONObject response = callAPIWithBodyAndParams(API.GET_TYPE, null, typeName);
             String typeJson = response.getString(DEFINITION);
             return TypesSerialization.fromJson(typeJson);
-        } catch (AtlasServiceException e) {
-            if (Response.Status.NOT_FOUND.equals(e.getStatus())) {
-                return null;
-            }
-            throw e;
         } catch (JSONException e) {
             throw new AtlasServiceException(e);
         }
diff --git a/client/src/main/java/org/apache/atlas/AtlasClientV2.java b/client/src/main/java/org/apache/atlas/AtlasClientV2.java
index 10638ad..6141342 100644
--- a/client/src/main/java/org/apache/atlas/AtlasClientV2.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClientV2.java
@@ -24,7 +24,6 @@
 import org.apache.atlas.model.discovery.AtlasSearchResult;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
-import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
@@ -55,9 +54,14 @@
     // Type APIs
     public static final String TYPES_API = BASE_URI + "v2/types/";
     private static final String TYPEDEFS_API = TYPES_API + "typedefs/";
+    private static final String TYPEDEF_BY_NAME = TYPES_API + "typedef/name/";
+    private static final String TYPEDEF_BY_GUID = TYPES_API + "typedef/guid/";
+
     private static final String GET_BY_NAME_TEMPLATE = TYPES_API + "%s/name/%s";
     private static final String GET_BY_GUID_TEMPLATE = TYPES_API + "%s/guid/%s";
 
+    private static final APIInfo GET_TYPEDEF_BY_NAME = new APIInfo(TYPEDEF_BY_NAME, HttpMethod.GET, Response.Status.OK);
+    private static final APIInfo GET_TYPEDEF_BY_GUID = new APIInfo(TYPEDEF_BY_GUID, HttpMethod.GET, Response.Status.OK);
     private static final APIInfo GET_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.GET, Response.Status.OK);
     private static final APIInfo CREATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.POST, Response.Status.OK);
     private static final APIInfo UPDATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.PUT, Response.Status.OK);
@@ -131,6 +135,24 @@
         return callAPI(GET_ALL_TYPE_DEFS, AtlasTypesDef.class, searchFilter.getParams());
     }
 
+    public boolean typeWithGuidExists(String guid) {
+        try {
+            callAPI(GET_TYPEDEF_BY_GUID, String.class, null, guid);
+        } catch (AtlasServiceException e) {
+            return false;
+        }
+        return true;
+    }
+
+    public boolean typeWithNameExists(String name) {
+        try {
+            callAPI(GET_TYPEDEF_BY_NAME, String.class, null, name);
+        } catch (AtlasServiceException e) {
+            return false;
+        }
+        return true;
+    }
+
     public AtlasEnumDef getEnumDefByName(final String name) throws AtlasServiceException {
         return getTypeDefByName(name, AtlasEnumDef.class);
     }
@@ -389,13 +411,13 @@
     }
 
     private <T> String getAtlasPath(Class<T> typeDefClass) {
-        if (typeDefClass.isAssignableFrom(AtlasEnumDef.class)) {
+        if (AtlasEnumDef.class.isAssignableFrom(typeDefClass)) {
             return "enumdef";
-        } else if (typeDefClass.isAssignableFrom(AtlasEntityDef.class)) {
+        } else if (AtlasEntityDef.class.isAssignableFrom(typeDefClass)) {
             return "entitydef";
-        } else if (typeDefClass.isAssignableFrom(AtlasClassificationDef.class)) {
+        } else if (AtlasClassificationDef.class.isAssignableFrom(typeDefClass)) {
             return "classificationdef";
-        } else if (typeDefClass.isAssignableFrom(AtlasStructDef.class)) {
+        } else if (AtlasStructDef.class.isAssignableFrom(typeDefClass)) {
             return "structdef";
         }
         // Code should never reach this point
diff --git a/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java b/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
index 3f8760f..5e6d6db 100644
--- a/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
+++ b/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
@@ -17,13 +17,13 @@
  */
 package org.apache.atlas;
 
+import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.model.legacy.EntityResult;
+import org.apache.atlas.type.AtlasType;
+
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.atlas.AtlasClient.EntityResult;
-import org.apache.atlas.model.instance.GuidMapping;
-import org.apache.atlas.type.AtlasType;
-
 /**
  * Result from creating or updating entities.
  */
diff --git a/client/src/test/java/org/apache/atlas/AtlasClientTest.java b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
index 56c4ae6..0c78916 100644
--- a/client/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -21,7 +21,7 @@
 import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.WebResource;
-
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.commons.configuration.Configuration;
@@ -33,15 +33,14 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
 import java.net.ConnectException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.List;
 
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyString;
@@ -94,7 +93,7 @@
         ClientResponse response = mock(ClientResponse.class);
         when(response.getStatus()).thenReturn(Response.Status.CREATED.getStatusCode());
 
-        JSONObject jsonResponse = new JSONObject(new AtlasClient.EntityResult(Arrays.asList("id"), null, null).toString());
+        JSONObject jsonResponse = new JSONObject(new EntityResult(Arrays.asList("id"), null, null).toString());
         when(response.getEntity(String.class)).thenReturn(jsonResponse.toString());
         when(response.getLength()).thenReturn(jsonResponse.length());
         String entityJson = InstanceSerialization.toJson(new Referenceable("type"), true);
diff --git a/common/pom.xml b/common/pom.xml
index 48df41f..bcbb5c5 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -36,8 +36,8 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
         </dependency>
 
         <dependency>
@@ -65,6 +65,12 @@
             <artifactId>spring-beans</artifactId>
             <version>${spring.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>compile</scope>
+        </dependency>
 
         <dependency>
             <groupId>com.google.guava</groupId>
diff --git a/common/src/main/java/org/apache/atlas/CommonConfiguration.java b/common/src/main/java/org/apache/atlas/CommonConfiguration.java
new file mode 100644
index 0000000..8ef9f8b
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/CommonConfiguration.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class CommonConfiguration {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CommonConfiguration.class);
+
+    @Bean
+    public org.apache.commons.configuration.Configuration getAtlasConfig() throws AtlasException {
+        try {
+            return ApplicationProperties.get();
+        } catch (AtlasException e) {
+            LOGGER.warn("AtlasConfig init failed", e);
+            throw e;
+        }
+    }
+}
diff --git a/repository/src/test/java/org/apache/atlas/TestOnlyModule.java b/common/src/main/java/org/apache/atlas/annotation/AtlasService.java
similarity index 66%
rename from repository/src/test/java/org/apache/atlas/TestOnlyModule.java
rename to common/src/main/java/org/apache/atlas/annotation/AtlasService.java
index c930953..fe34027 100644
--- a/repository/src/test/java/org/apache/atlas/TestOnlyModule.java
+++ b/common/src/main/java/org/apache/atlas/annotation/AtlasService.java
@@ -15,16 +15,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.atlas;
+package org.apache.atlas.annotation;
 
-import org.apache.atlas.graph.GraphSandboxUtil;
+import org.springframework.stereotype.Service;
 
-public class TestOnlyModule extends RepositoryMetadataModule {
-    @Override
-    protected void configure() {
-        GraphSandboxUtil.create();
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-        // Configure extra stuff for test DI here
-        super.configure();
-    }
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Service
+@Inherited
+public @interface AtlasService {
 }
diff --git a/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java b/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java
new file mode 100644
index 0000000..427e3a8
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.annotation;
+
+import org.apache.atlas.utils.OnAtlasPropertyCondition;
+import org.springframework.context.annotation.Conditional;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Conditional(OnAtlasPropertyCondition.class)
+public @interface ConditionalOnAtlasProperty {
+    // Configured atlas property
+    String property();
+    // The default interface implementation should declare this as true
+    boolean isDefault() default false;
+}
diff --git a/repository/src/main/java/org/apache/atlas/GraphTransaction.java b/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
similarity index 96%
rename from repository/src/main/java/org/apache/atlas/GraphTransaction.java
rename to common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
index b73f4ed..7120166 100644
--- a/repository/src/main/java/org/apache/atlas/GraphTransaction.java
+++ b/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas;
+package org.apache.atlas.annotation;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
diff --git a/common/src/main/java/org/apache/atlas/service/Services.java b/common/src/main/java/org/apache/atlas/service/Services.java
index 588dd8e..6f880e4 100644
--- a/common/src/main/java/org/apache/atlas/service/Services.java
+++ b/common/src/main/java/org/apache/atlas/service/Services.java
@@ -17,38 +17,49 @@
  */
 package org.apache.atlas.service;
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import org.apache.atlas.annotation.AtlasService;
+import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Profile;
 
-import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import java.util.List;
 
 /**
  * Utility for starting and stopping all services.
  */
-@Singleton
+@AtlasService
+@Profile("!test")
 public class Services {
     public static final Logger LOG = LoggerFactory.getLogger(Services.class);
 
-    private final Set<Service> services;
+    private final List<Service> services;
+    private final Configuration configuration;
 
     @Inject
-    public Services(Set<Service> services) {
+    public Services(List<Service> services, Configuration configuration) {
         this.services = services;
+        this.configuration = configuration;
     }
 
+    @PostConstruct
     public void start() {
-        try {
-            for (Service service : services) {
-                LOG.info("Starting service {}", service.getClass().getName());
-                service.start();
+        if (configuration.getBoolean("atlas.services.enabled", true)) {
+            try {
+                for (Service service : services) {
+                    LOG.info("Starting service {}", service.getClass().getName());
+                    service.start();
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(e);
             }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
         }
     }
 
+    @PreDestroy
     public void stop() {
         for (Service service : services) {
             LOG.info("Stopping service {}", service.getClass().getName());
diff --git a/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java
new file mode 100644
index 0000000..ece6e37
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.utils;
+
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Condition;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+import org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor;
+
+public class OnAtlasPropertyCondition implements Condition {
+    private final Logger LOG = LoggerFactory.getLogger(OnAtlasPropertyCondition.class);
+
+    @Override
+    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
+        boolean matches = false;
+        String propertyName = (String) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("property");
+        boolean isDefault = (Boolean) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("isDefault");
+        String className = ((AnnotationMetadataReadingVisitor) metadata).getClassName();
+
+        try {
+            Configuration configuration = ApplicationProperties.get();
+            String configuredProperty = configuration.getString(propertyName);
+            if (StringUtils.isNotEmpty(configuredProperty)) {
+                matches = configuredProperty.equals(className);
+            } else if (isDefault) matches = true;
+        } catch (AtlasException e) {
+            LOG.error("Unable to load atlas properties. Dependent bean configuration may fail");
+        }
+        return matches;
+    }
+}
diff --git a/distro/pom.xml b/distro/pom.xml
index f0962b6..3ffaee9 100644
--- a/distro/pom.xml
+++ b/distro/pom.xml
@@ -126,6 +126,9 @@
                 <titan.storage.backend>berkeleyje</titan.storage.backend>
                 <titan.storage.properties>#Berkeley
 atlas.graph.storage.directory=${sys:atlas.home}/data/berkley
+atlas.graph.storage.lock.clean-expired=true
+atlas.graph.storage.lock.expiry-time=500
+atlas.graph.storage.lock.wait-time=300
                 </titan.storage.properties>
                 <titan.index.backend>elasticsearch</titan.index.backend>
                 <titan.index.properties>#ElasticSearch
diff --git a/distro/src/conf/atlas-log4j.xml b/distro/src/conf/atlas-log4j.xml
index a79b722..e6c0d9f 100755
--- a/distro/src/conf/atlas-log4j.xml
+++ b/distro/src/conf/atlas-log4j.xml
@@ -69,6 +69,21 @@
         <appender-ref ref="FILE"/>
     </logger>
 
+    <logger name="org.springframework" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
+    <logger name="org.eclipse" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
+    <logger name="com.sun.jersey" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
     <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config -->
     <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false">
         <level value="error"/>
diff --git a/graphdb/titan0/pom.xml b/graphdb/titan0/pom.xml
index 71f2832..ceda1bb 100644
--- a/graphdb/titan0/pom.xml
+++ b/graphdb/titan0/pom.xml
@@ -51,7 +51,7 @@
                         <artifactId>maven-surefire-plugin</artifactId>
                         <version>2.18.1</version>
                         <configuration>
-                            <skip>false</skip>
+                            <skip>${skipUTs}</skip>
                         </configuration>
                     </plugin>
                 </plugins>
@@ -81,13 +81,6 @@
             <version>${guava.version}</version>
         </dependency>
 
-
-        <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
         <dependency>
             <groupId>commons-configuration</groupId>
             <artifactId>commons-configuration</artifactId>
diff --git a/graphdb/titan1/pom.xml b/graphdb/titan1/pom.xml
index 5611193..fc0b2f6 100644
--- a/graphdb/titan1/pom.xml
+++ b/graphdb/titan1/pom.xml
@@ -71,7 +71,7 @@
                         <artifactId>maven-surefire-plugin</artifactId>
                         <version>2.18.1</version>
                         <configuration>
-                            <skip>false</skip>
+                            <skip>${skipUTs}</skip>
                         </configuration>
                     </plugin>
                     <plugin>
@@ -106,12 +106,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
             <groupId>commons-configuration</groupId>
             <artifactId>commons-configuration</artifactId>
             <scope>provided</scope>
diff --git a/intg/pom.xml b/intg/pom.xml
index 7f3ab12..2a06ea9 100644
--- a/intg/pom.xml
+++ b/intg/pom.xml
@@ -67,6 +67,11 @@
             <artifactId>testng</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index 298df6b..d723b2a 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -96,7 +96,7 @@
     DISCOVERY_QUERY_FAILED(500, "ATLAS-500-00-004", "Discovery query failed {0}"),
     FAILED_TO_OBTAIN_TYPE_UPDATE_LOCK(500, "ATLAS-500-00-005", "Failed to get the lock; another type update might be in progress. Please try again"),
     FAILED_TO_OBTAIN_IMPORT_EXPORT_LOCK(500, "ATLAS-500-00-006", "Another import or export is in progress. Please try again"),
-    NOTIFICATION_FAILED(500, "ATLAS-500-00-007", "Failed to notify for change {0}"),
+    NOTIFICATION_FAILED(500, "ATLAS-500-00-007", "Failed to notify {0} for change {1}"),
     FAILED_TO_OBTAIN_GREMLIN_SCRIPT_ENGINE(500, "ATLAS-500-00-008", "Failed to obtain gremlin script engine: {0}"),
     JSON_ERROR_OBJECT_MAPPER_NULL_RETURNED(500, "ATLAS-500-00-009", "ObjectMapper.readValue returned NULL for class: {0}"),
     GREMLIN_SCRIPT_EXECUTION_FAILED(500, "ATLAS-500-00-00A", "Gremlin script execution failed: {0}"),
diff --git a/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java b/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java
new file mode 100644
index 0000000..e6cef97
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.model.legacy;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class EntityResult {
+    private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
+    public static final String OP_CREATED = "created";
+    public static final String OP_UPDATED = "updated";
+    public static final String OP_DELETED = "deleted";
+
+    Map<String, List<String>> entities = new HashMap<>();
+
+    public EntityResult() {
+        //For gson
+    }
+
+    public EntityResult(List<String> created, List<String> updated, List<String> deleted) {
+        set(OP_CREATED, created);
+        set(OP_UPDATED, updated);
+        set(OP_DELETED, deleted);
+    }
+
+    public void set(String type, List<String> list) {
+        if (list != null && list.size() > 0) {
+            entities.put(type, list);
+        }
+    }
+
+    private List<String> get(String type) {
+        List<String> list = entities.get(type);
+        if (list == null) {
+            list = new ArrayList<>();
+        }
+        return list;
+    }
+
+    public Map<String, List<String>> getEntities(){
+        return entities;
+    }
+
+    public void setEntities(Map<String, List<String>> entities){
+        this.entities = entities;
+    }
+
+    @JsonIgnore
+    public List<String> getCreatedEntities() {
+        return get(OP_CREATED);
+    }
+
+    @JsonIgnore
+    public List<String> getUpdateEntities() {
+        return get(OP_UPDATED);
+    }
+
+    @JsonIgnore
+    public List<String> getDeletedEntities() {
+        return get(OP_DELETED);
+    }
+
+    @Override
+    public String toString() { return gson.toJson(this); }
+
+    public static EntityResult fromString(String json) {
+        return gson.fromJson(json, EntityResult.class);
+    }
+}
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index 29ea603..1b3526b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -17,8 +17,6 @@
  */
 package org.apache.atlas.type;
 
-import com.sun.jersey.spi.resource.Singleton;
-
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
@@ -31,7 +29,9 @@
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Singleton;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -41,16 +41,13 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
 
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_PREFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_KEY_VAL_SEP;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_PREFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUFFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.*;
 
 /**
  * registry for all types defined in Atlas.
  */
 @Singleton
+@Component
 public class AtlasTypeRegistry {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasStructType.class);
     private static final int    DEFAULT_LOCK_MAX_WAIT_TIME_IN_SECONDS = 15;
diff --git a/notification/pom.xml b/notification/pom.xml
index c4a1115..daa5d11 100644
--- a/notification/pom.xml
+++ b/notification/pom.xml
@@ -61,21 +61,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-multibindings</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
         </dependency>
diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
index 65b88e9..a8609e6 100644
--- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
+++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
@@ -19,12 +19,10 @@
 package org.apache.atlas.hook;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
 import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.notification.NotificationException;
 import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
 import org.apache.atlas.notification.hook.HookNotification;
 import org.apache.atlas.security.InMemoryJAASConfiguration;
 import org.apache.atlas.typesystem.Referenceable;
@@ -51,7 +49,7 @@
 
     protected static Configuration atlasProperties;
 
-    protected static NotificationInterface notifInterface;
+    protected static NotificationInterface notificationInterface;
 
     private static boolean logFailedMessages;
     private static FailedMessagesLogger failedMessagesLogger;
@@ -86,8 +84,7 @@
         }
 
         notificationRetryInterval = atlasProperties.getInt(ATLAS_NOTIFICATION_RETRY_INTERVAL, 1000);
-        Injector injector = Guice.createInjector(new NotificationModule());
-        notifInterface = injector.getInstance(NotificationInterface.class);
+        notificationInterface = NotificationProvider.get();
 
         LOG.info("Created Atlas Hook");
     }
@@ -118,7 +115,7 @@
      * @param maxRetries maximum number of retries while sending message to messaging system
      */
     public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
-        notifyEntitiesInternal(messages, maxRetries, notifInterface, logFailedMessages, failedMessagesLogger);
+        notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
     }
 
     @VisibleForTesting
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
index 77c1711..8bd31fd 100644
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
+++ b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
@@ -18,7 +18,6 @@
 package org.apache.atlas.kafka;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Singleton;
 import kafka.consumer.Consumer;
 import kafka.consumer.KafkaStream;
 import kafka.javaapi.consumer.ConsumerConnector;
@@ -46,8 +45,11 @@
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
 import scala.Option;
 
+import javax.inject.Inject;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -64,7 +66,8 @@
 /**
  * Kafka specific access point to the Atlas notification framework.
  */
-@Singleton
+@Component
+@Order(3)
 public class KafkaNotification extends AbstractNotification implements Service {
     public static final Logger LOG = LoggerFactory.getLogger(KafkaNotification.class);
 
@@ -105,6 +108,7 @@
      *
      * @throws AtlasException if the notification interface can not be created
      */
+    @Inject
     public KafkaNotification(Configuration applicationProperties) throws AtlasException {
         super(applicationProperties);
         Configuration subsetConfiguration =
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
similarity index 64%
rename from notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java
rename to notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
index fd0e518..2dd970e 100644
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java
+++ b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
@@ -17,27 +17,25 @@
  */
 package org.apache.atlas.kafka;
 
-import com.google.inject.Provider;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.commons.configuration.Configuration;
 
 /**
- * Provider class that provides KafkaNotification for Guice.
+ * Provider class for Notification interfaces
  */
-public class KafkaNotificationProvider implements Provider<KafkaNotification> {
+public class NotificationProvider {
+    private static KafkaNotification kafka;
 
-    @Override
-    @Provides
-    @Singleton
-    public KafkaNotification get() {
-        try {
-            Configuration applicationProperties = ApplicationProperties.get();
-            return new KafkaNotification(applicationProperties);
-        } catch(AtlasException e) {
-            throw new RuntimeException(e);
+    public static KafkaNotification get() {
+        if (kafka == null) {
+            try {
+                Configuration applicationProperties = ApplicationProperties.get();
+                kafka = new KafkaNotification(applicationProperties);
+            } catch (AtlasException e) {
+                throw new RuntimeException(e);
+            }
         }
+        return kafka;
     }
 }
diff --git a/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java b/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java
deleted file mode 100644
index 44d08d3..0000000
--- a/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.notification;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import org.apache.atlas.kafka.KafkaNotification;
-import org.apache.atlas.kafka.KafkaNotificationProvider;
-
-/**
- * Notification module for Guice.
- *
- * NOTE: This module is loaded by hook clients like hive hook etc. Don't add any server specific bindings here.
- */
-public class NotificationModule extends AbstractModule {
-
-    @Override
-    protected void configure() {
-        bind(NotificationInterface.class).to(KafkaNotification.class).in(Singleton.class);
-        bind(KafkaNotification.class).toProvider(KafkaNotificationProvider.class).in(Singleton.class);
-    }
-}
diff --git a/pom.xml b/pom.xml
index cc8c94f..a93b8ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -496,9 +496,9 @@
         <gson.version>2.5</gson.version>
         <fastutil.version>6.5.16</fastutil.version>
         <guice.version>4.1.0</guice.version>
-        <spring.version>3.1.3.RELEASE</spring.version>
-        <spring.security.version>3.1.3.RELEASE</spring.security.version>
-        <spring-ldap-core.version>1.3.1.RELEASE</spring-ldap-core.version>
+        <spring.version>4.3.8.RELEASE</spring.version>
+        <spring.security.version>4.2.2.RELEASE</spring.security.version>
+        <spring-ldap-core.version>2.3.1.RELEASE</spring-ldap-core.version>
         <javax.servlet.version>3.1.0</javax.servlet.version>
         <guava.version>19.0</guava.version>
 
@@ -535,21 +535,9 @@
         <atlas.surefire.options></atlas.surefire.options>
 
         <aspectj.runtime.version>1.8.7</aspectj.runtime.version>
-        <aspectj.skip>true</aspectj.skip>
     </properties>
 
     <profiles>
-        <!-- Turn on this profile to instrument atlas server to collect performance metrics -->
-        <profile>
-            <id>perf</id>
-            <activation>
-                <activeByDefault>false</activeByDefault>
-            </activation>
-            <properties>
-                <aspectj.skip>false</aspectj.skip>
-            </properties>
-        </profile>
-
         <!-- Turning on this profile affects only tests and does not affect packaging -->
         <profile>
             <id>distributed</id>
@@ -687,18 +675,6 @@
                 <artifactId>guava</artifactId>
                 <version>${guava.version}</version>
             </dependency>
-            <!-- AOP dependencies. -->
-            <dependency>
-                <groupId>org.aspectj</groupId>
-                <artifactId>aspectjrt</artifactId>
-                <version>${aspectj.runtime.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.aspectj</groupId>
-                <artifactId>aspectjtools</artifactId>
-                <version>${aspectj.runtime.version}</version>
-            </dependency>
-
             <dependency>
                 <groupId>org.eclipse.jetty</groupId>
                 <artifactId>jetty-jsp</artifactId>
@@ -916,44 +892,14 @@
                 <version>${commons-collections.version}</version>
             </dependency>
 
+            <!--Javax inject-->
+            <dependency>
+                <groupId>javax.inject</groupId>
+                <artifactId>javax.inject</artifactId>
+                <version>${javax-inject.version}</version>
+            </dependency>
             <!-- utilities -->
             <dependency>
-                <groupId>com.google.inject</groupId>
-                <artifactId>guice</artifactId>
-                <version>${guice.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>com.google.guava</groupId>
-                        <artifactId>guava</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-
-            <dependency>
-                <groupId>com.google.inject.extensions</groupId>
-                <artifactId>guice-throwingproviders</artifactId>
-                <version>${guice.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>com.google.inject.extensions</groupId>
-                <artifactId>guice-multibindings</artifactId>
-                <version>${guice.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>com.google.inject.extensions</groupId>
-                <artifactId>guice-servlet</artifactId>
-                <version>${guice.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>com.sun.jersey.contribs</groupId>
-                <artifactId>jersey-guice</artifactId>
-                <version>1.18.3</version>
-            </dependency>
-
-            <dependency>
                 <groupId>org.skyscreamer</groupId>
                 <artifactId>jsonassert</artifactId>
                 <version>1.2.0</version>
@@ -998,6 +944,12 @@
             </dependency>
 
             <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-servlet</artifactId>
+                <version>${jersey.version}</version>
+            </dependency>
+
+            <dependency>
                 <groupId>javax.servlet.jsp</groupId>
                 <artifactId>jsp-api</artifactId>
                 <version>2.0</version>
@@ -1104,6 +1056,12 @@
 
             <dependency>
                 <groupId>com.thinkaurelius.titan</groupId>
+                <artifactId>titan-lucene</artifactId>
+                <version>${titan.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.thinkaurelius.titan</groupId>
                 <artifactId>titan-hbase</artifactId>
                 <version>${titan.version}</version>
             </dependency>
@@ -1203,6 +1161,73 @@
                 <version>${solr.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>javax.servlet-api</artifactId>
+                <version>${javax.servlet.version}</version>
+            </dependency>
+
+            <!-- Spring -->
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-core</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-web</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-webmvc</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-core</artifactId>
+                <version>${spring.security.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-web</artifactId>
+                <version>${spring.security.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-config</artifactId>
+                <version>${spring.security.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-ldap</artifactId>
+                <version>${spring.security.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.ldap</groupId>
+                <artifactId>spring-ldap-core</artifactId>
+                <version>${spring-ldap-core.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-aop</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-test</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
             <!--  atlas modules -->
             <dependency>
                 <groupId>org.apache.atlas</groupId>
@@ -1603,6 +1628,11 @@
             <groupId>org.slf4j</groupId>
             <artifactId>jul-to-slf4j</artifactId>
         </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib</artifactId>
+            <version>2.2.2</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -1747,12 +1777,6 @@
                 </plugin>
 
                 <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>aspectj-maven-plugin</artifactId>
-                    <version>1.8</version>
-                </plugin>
-
-                <plugin>
                     <groupId>com.webcohesion.enunciate</groupId>
                     <artifactId>enunciate-maven-plugin</artifactId>
                     <version>2.8.0</version>
diff --git a/repository/pom.xml b/repository/pom.xml
index 54c779f..2573198 100755
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -76,21 +76,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-throwingproviders</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-multibindings</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.codehaus.jettison</groupId>
             <artifactId>jettison</artifactId>
         </dependency>
@@ -168,6 +153,20 @@
             <artifactId>atlas-hbase-server-shaded</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-multibindings</artifactId>
+            <version>4.1.0</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -235,47 +234,6 @@
                     </properties>
                 </configuration>
             </plugin>
-
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>aspectj-maven-plugin</artifactId>
-                <configuration>
-                    <complianceLevel>1.7</complianceLevel>
-                    <includes>
-                        <include>**/*.java</include>
-                        <include>**/*.aj</include>
-                    </includes>
-                    <XaddSerialVersionUID>true</XaddSerialVersionUID>
-                    <showWeaveInfo>true</showWeaveInfo>
-                    <aspectLibraries>
-                        <aspectLibrary>
-                            <groupId>org.apache.atlas</groupId>
-                            <artifactId>atlas-server-api</artifactId>
-                        </aspectLibrary>
-                    </aspectLibraries>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>compile_with_aspectj</id>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjtools</artifactId>
-                        <version>${aspectj.runtime.version}</version>
-                    </dependency>
-
-                    <dependency>
-                        <groupId>org.apache.atlas</groupId>
-                        <artifactId>atlas-server-api</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
         </plugins>
     </build>
 </project>
diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionAdvisor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionAdvisor.java
new file mode 100644
index 0000000..9751a87
--- /dev/null
+++ b/repository/src/main/java/org/apache/atlas/GraphTransactionAdvisor.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.aopalliance.aop.Advice;
+import org.apache.atlas.annotation.GraphTransaction;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.aop.Pointcut;
+import org.springframework.aop.support.AbstractPointcutAdvisor;
+import org.springframework.aop.support.StaticMethodMatcherPointcut;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+import java.lang.reflect.Method;
+
+@Component
+public class GraphTransactionAdvisor extends AbstractPointcutAdvisor {
+    private static final Logger LOG = LoggerFactory.getLogger(GraphTransactionAdvisor.class);
+
+    private final StaticMethodMatcherPointcut pointcut = new StaticMethodMatcherPointcut() {
+        @Override
+        public boolean matches(Method method, Class<?> targetClass) {
+            boolean annotationPresent = method.isAnnotationPresent(GraphTransaction.class);
+            if (annotationPresent) {
+                LOG.info("GraphTransaction intercept for {}.{}", targetClass.getName(), method.getName());
+            }
+            return annotationPresent;
+        }
+    };
+
+    private final GraphTransactionInterceptor interceptor;
+
+    @Inject
+    public GraphTransactionAdvisor(GraphTransactionInterceptor interceptor) {
+        this.interceptor = interceptor;
+    }
+
+    @Override
+    public Pointcut getPointcut() {
+        return pointcut;
+    }
+
+    @Override
+    public Advice getAdvice() {
+        return interceptor;
+    }
+}
diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
index 0f85b61..7d3bdf7 100644
--- a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
+++ b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
@@ -20,30 +20,32 @@
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
 import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.typesystem.exception.NotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import javax.ws.rs.core.Response;
 import java.util.ArrayList;
 import java.util.List;
 
+@Component
 public class GraphTransactionInterceptor implements MethodInterceptor {
     private static final Logger LOG = LoggerFactory.getLogger(GraphTransactionInterceptor.class);
 
     private static final ThreadLocal<List<PostTransactionHook>> postTransactionHooks = new ThreadLocal<>();
 
-    private AtlasGraph graph;
+    private final AtlasGraph graph;
+
+    @Inject
+    public GraphTransactionInterceptor(AtlasGraph graph) {
+        this.graph = graph;
+    }
 
     @Override
     public Object invoke(MethodInvocation invocation) throws Throwable {
-        
-        if (graph == null) {
-            graph = AtlasGraphProvider.getGraphInstance();
-        }
-
         boolean isSuccess = false;
 
         try {
diff --git a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
deleted file mode 100755
index 6c175ae..0000000
--- a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas;
-
-import com.google.inject.Binder;
-import com.google.inject.Singleton;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.multibindings.Multibinder;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.apache.atlas.discovery.AtlasDiscoveryService;
-import org.apache.atlas.discovery.AtlasLineageService;
-import org.apache.atlas.discovery.DataSetLineageService;
-import org.apache.atlas.discovery.DiscoveryService;
-import org.apache.atlas.discovery.EntityDiscoveryService;
-import org.apache.atlas.discovery.EntityLineageService;
-import org.apache.atlas.discovery.LineageService;
-import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
-import org.apache.atlas.listener.EntityChangeListener;
-import org.apache.atlas.listener.TypeDefChangeListener;
-import org.apache.atlas.listener.TypesChangeListener;
-import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.audit.EntityAuditListener;
-import org.apache.atlas.repository.audit.EntityAuditRepository;
-import org.apache.atlas.repository.graph.DeleteHandler;
-import org.apache.atlas.repository.graph.GraphBackedMetadataRepository;
-import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEntityStore;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityDefStoreV1;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1;
-import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1;
-import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
-import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
-import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
-import org.apache.atlas.repository.typestore.ITypeStore;
-import org.apache.atlas.service.Service;
-import org.apache.atlas.services.DefaultMetadataService;
-import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.store.AtlasTypeDefStore;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.TypeSystemProvider;
-import org.apache.atlas.typesystem.types.cache.TypeCache;
-import org.apache.atlas.util.AtlasRepositoryConfiguration;
-import org.apache.commons.configuration.Configuration;
-
-/**
- * Guice module for Repository module.
- */
-public class RepositoryMetadataModule extends com.google.inject.AbstractModule {
-
-    @Override
-    protected void configure() {
-
-        // allow for dynamic binding of the metadata repo & graph service
-        // bind the MetadataRepositoryService interface to an implementation
-        bind(MetadataRepository.class).to(GraphBackedMetadataRepository.class).asEagerSingleton();
-
-        bind(TypeSystem.class).toProvider(TypeSystemProvider.class).in(Singleton.class);
-
-        // bind the ITypeStore interface to an implementation
-        bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton();
-        bind(AtlasTypeDefStore.class).to(AtlasTypeDefGraphStoreV1.class).asEagerSingleton();
-
-        //For testing
-        bind(AtlasEntityDefStore.class).to(AtlasEntityDefStoreV1.class).asEagerSingleton();
-        bind(AtlasTypeRegistry.class).asEagerSingleton();
-
-        //GraphBackedSearchIndexer must be an eager singleton to force the search index creation to happen before
-        //we try to restore the type system (otherwise we'll end up running queries
-        //before we have any indices during the initial graph setup)
-        Multibinder<TypesChangeListener> typesChangeListenerBinder =
-                Multibinder.newSetBinder(binder(), TypesChangeListener.class);
-        typesChangeListenerBinder.addBinding().to(GraphBackedSearchIndexer.class).asEagerSingleton();
-
-        // New typesdef/instance change listener should also be bound to the corresponding implementation
-        Multibinder<TypeDefChangeListener> typeDefChangeListenerMultibinder =
-                Multibinder.newSetBinder(binder(), TypeDefChangeListener.class);
-        typeDefChangeListenerMultibinder.addBinding().to(DefaultMetadataService.class);
-        typeDefChangeListenerMultibinder.addBinding().to(GraphBackedSearchIndexer.class).asEagerSingleton();
-
-        bind(AtlasEntityStore.class).to(AtlasEntityStoreV1.class);
-
-        // bind the MetadataService interface to an implementation
-        bind(MetadataService.class).to(DefaultMetadataService.class).asEagerSingleton();
-
-        // bind the DiscoveryService interface to an implementation
-        bind(DiscoveryService.class).to(GraphBackedDiscoveryService.class).asEagerSingleton();
-        bind(AtlasDiscoveryService.class).to(EntityDiscoveryService.class).asEagerSingleton();
-
-        bind(LineageService.class).to(DataSetLineageService.class).asEagerSingleton();
-        bind(AtlasLineageService.class).to(EntityLineageService.class).asEagerSingleton();
-
-        Configuration configuration = getConfiguration();
-        bindAuditRepository(binder(), configuration);
-
-        bind(DeleteHandler.class).to(AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
-
-        bind(DeleteHandlerV1.class).to(AtlasRepositoryConfiguration.getDeleteHandlerV1Impl()).asEagerSingleton();
-
-        bind(TypeCache.class).to(AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
-
-        bind(EntityGraphMapper.class);
-
-        //Add EntityAuditListener as EntityChangeListener
-        Multibinder<EntityChangeListener> entityChangeListenerBinder =
-                Multibinder.newSetBinder(binder(), EntityChangeListener.class);
-        entityChangeListenerBinder.addBinding().to(EntityAuditListener.class);
-
-        MethodInterceptor interceptor = new GraphTransactionInterceptor();
-        requestInjection(interceptor);
-        bindInterceptor(Matchers.any(), Matchers.annotatedWith(GraphTransaction.class), interceptor);
-    }
-
-    protected Configuration getConfiguration() {
-        try {
-            return ApplicationProperties.get();
-        } catch (AtlasException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected void bindAuditRepository(Binder binder, Configuration configuration) {
-
-        Class<? extends EntityAuditRepository> auditRepoImpl = AtlasRepositoryConfiguration.getAuditRepositoryImpl();
-
-        //Map EntityAuditRepository interface to configured implementation
-        binder.bind(EntityAuditRepository.class).to(auditRepoImpl).asEagerSingleton();
-
-        if(Service.class.isAssignableFrom(auditRepoImpl)) {
-            Class<? extends Service> auditRepoService = (Class<? extends Service>)auditRepoImpl;
-            //if it's a service, make sure that it gets properly closed at shutdown
-            Multibinder<Service> serviceBinder = Multibinder.newSetBinder(binder, Service.class);
-            serviceBinder.addBinding().to(auditRepoService);
-        }
-    }
-
-}
diff --git a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
index b65b67d..af7f1b4 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
@@ -18,17 +18,11 @@
 
 package org.apache.atlas.discovery;
 
-import java.util.Arrays;
-import java.util.Iterator;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasConfiguration;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.GraphTransaction;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.query.GremlinQueryResult;
@@ -37,7 +31,6 @@
 import org.apache.atlas.query.QueryParams;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
@@ -49,16 +42,22 @@
 import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
+import org.springframework.stereotype.Component;
 import scala.Option;
 import scala.Some;
 import scala.collection.JavaConversions;
 import scala.collection.immutable.List;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.util.Arrays;
+import java.util.Iterator;
+
 /**
  * Hive implementation of Lineage service interface.
  */
 @Singleton
+@Component
 public class DataSetLineageService implements LineageService {
 
     private static final Logger LOG = LoggerFactory.getLogger(DataSetLineageService.class);
@@ -91,8 +90,9 @@
 
     @Inject
     DataSetLineageService(MetadataRepository metadataRepository,
-                          GraphBackedDiscoveryService discoveryService) throws DiscoveryException {
-        this.graph = AtlasGraphProvider.getGraphInstance();
+                          GraphBackedDiscoveryService discoveryService,
+                          AtlasGraph atlasGraph) throws DiscoveryException {
+        this.graph = atlasGraph;
         this.graphPersistenceStrategy = new DefaultGraphPersistenceStrategy(metadataRepository);
         this.discoveryService = discoveryService;
     }
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
index 1b4583a..128cdbf 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -20,7 +20,6 @@
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasConfiguration;
 import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.discovery.AtlasSearchResult;
@@ -28,6 +27,7 @@
 import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasQueryType;
 import org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult;
 import org.apache.atlas.model.instance.AtlasEntity.Status;
+import org.apache.atlas.AtlasException;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.query.Expressions.AliasExpression;
 import org.apache.atlas.query.Expressions.Expression;
@@ -40,7 +40,6 @@
 import org.apache.atlas.query.SelectExpressionHelper;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasIndexQuery;
@@ -58,6 +57,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 import scala.Option;
 import scala.util.Either;
 import scala.util.parsing.combinator.Parsers.NoSuccess;
@@ -73,10 +73,11 @@
 import java.util.Map;
 import java.util.Set;
 
+import static org.apache.atlas.AtlasErrorCode.CLASSIFICATION_NOT_FOUND;
 import static org.apache.atlas.AtlasErrorCode.DISCOVERY_QUERY_FAILED;
 import static org.apache.atlas.AtlasErrorCode.UNKNOWN_TYPENAME;
-import static org.apache.atlas.AtlasErrorCode.CLASSIFICATION_NOT_FOUND;
 
+@Component
 public class EntityDiscoveryService implements AtlasDiscoveryService {
     private static final Logger LOG = LoggerFactory.getLogger(EntityDiscoveryService.class);
 
@@ -90,8 +91,8 @@
     private final int                             maxTagsCountInIdxQuery;
 
     @Inject
-    EntityDiscoveryService(MetadataRepository metadataRepository, AtlasTypeRegistry typeRegistry) throws AtlasException {
-        this.graph                    = AtlasGraphProvider.getGraphInstance();
+    EntityDiscoveryService(MetadataRepository metadataRepository, AtlasTypeRegistry typeRegistry, AtlasGraph graph) throws AtlasException {
+        this.graph                    = graph;
         this.graphPersistenceStrategy = new DefaultGraphPersistenceStrategy(metadataRepository);
         this.entityRetriever          = new EntityGraphRetriever(typeRegistry);
         this.gremlinQueryProvider     = AtlasGremlinQueryProvider.INSTANCE;
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java
index d6aca89..b07091a 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java
@@ -24,10 +24,9 @@
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.lineage.AtlasLineageInfo;
-import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
+import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
 import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
@@ -36,9 +35,9 @@
 import org.apache.atlas.util.AtlasGremlinQueryProvider;
 import org.apache.atlas.util.AtlasGremlinQueryProvider.AtlasGremlinQuery;
 import org.apache.commons.collections.CollectionUtils;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
-import javax.script.ScriptException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -46,6 +45,7 @@
 import java.util.Map;
 import java.util.Set;
 
+@Service
 public class EntityLineageService implements AtlasLineageService {
     private static final String INPUT_PROCESS_EDGE      =  "__Process.inputs";
     private static final String OUTPUT_PROCESS_EDGE     =  "__Process.outputs";
@@ -55,8 +55,8 @@
     private final EntityGraphRetriever      entityRetriever;
 
     @Inject
-    EntityLineageService(AtlasTypeRegistry typeRegistry) throws DiscoveryException {
-        this.graph                = AtlasGraphProvider.getGraphInstance();
+    EntityLineageService(AtlasTypeRegistry typeRegistry, AtlasGraph atlasGraph) throws DiscoveryException {
+        this.graph                = atlasGraph;
         this.gremlinQueryProvider = AtlasGremlinQueryProvider.INSTANCE;
         this.entityRetriever      = new EntityGraphRetriever(typeRegistry);
     }
diff --git a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
index 23e4531..083c34d 100755
--- a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
@@ -18,18 +18,8 @@
 
 package org.apache.atlas.discovery.graph;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
 import org.apache.atlas.AtlasClient;
-import org.apache.atlas.GraphTransaction;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.discovery.DiscoveryException;
 import org.apache.atlas.discovery.DiscoveryService;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -43,7 +33,6 @@
 import org.apache.atlas.query.QueryProcessor;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -56,14 +45,24 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
+import org.springframework.stereotype.Component;
 import scala.util.Either;
 import scala.util.parsing.combinator.Parsers;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Graph backed implementation of Search.
  */
 @Singleton
+@Component
 public class GraphBackedDiscoveryService implements DiscoveryService {
 
     private static final Logger LOG = LoggerFactory.getLogger(GraphBackedDiscoveryService.class);
@@ -74,9 +73,9 @@
     public final static String SCORE = "score";
 
     @Inject
-    GraphBackedDiscoveryService(MetadataRepository metadataRepository)
+    GraphBackedDiscoveryService(MetadataRepository metadataRepository, AtlasGraph atlasGraph)
     throws DiscoveryException {
-        this.graph = AtlasGraphProvider.getGraphInstance();
+        this.graph = atlasGraph;
         this.graphPersistenceStrategy = new DefaultGraphPersistenceStrategy(metadataRepository);
     }
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/MetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/MetadataRepository.java
index 9a873b3..b72ee7d 100644
--- a/repository/src/main/java/org/apache/atlas/repository/MetadataRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/MetadataRepository.java
@@ -18,9 +18,9 @@
 
 package org.apache.atlas.repository;
 
-import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
 import org.apache.atlas.typesystem.exception.EntityExistsException;
@@ -135,7 +135,7 @@
      * @return guids of deleted entities
      * @throws RepositoryException
      */
-    AtlasClient.EntityResult deleteEntities(List<String> guids) throws RepositoryException;
+    EntityResult deleteEntities(List<String> guids) throws RepositoryException;
     
     
     // Trait management functions
diff --git a/repository/src/main/java/org/apache/atlas/repository/RepositoryConfiguration.java b/repository/src/main/java/org/apache/atlas/repository/RepositoryConfiguration.java
new file mode 100644
index 0000000..261a6d0
--- /dev/null
+++ b/repository/src/main/java/org/apache/atlas/repository/RepositoryConfiguration.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.repository;
+
+import org.apache.atlas.repository.graphdb.GraphDatabase;
+import org.apache.atlas.typesystem.types.TypeSystem;
+import org.apache.atlas.util.AtlasRepositoryConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RepositoryConfiguration {
+    @Bean
+    public GraphDatabase getGraphDatabase() throws IllegalAccessException, InstantiationException {
+        return AtlasRepositoryConfiguration.getGraphDatabaseImpl().newInstance();
+    }
+
+    @Bean
+    public TypeSystem getTypeSystem() {
+        return TypeSystem.getInstance();
+    }
+}
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
index eab86c4..2a1881b 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
@@ -32,6 +32,7 @@
 import org.apache.commons.collections.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.nio.charset.StandardCharsets;
@@ -44,6 +45,7 @@
 /**
  * Listener on entity create/update/delete, tag add/delete. Adds the corresponding audit event to the audit repository.
  */
+@Component
 public class EntityAuditListener implements EntityChangeListener {
     private static final Logger LOG = LoggerFactory.getLogger(EntityAuditListener.class);
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
index 9de2110..89ca748 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
@@ -19,10 +19,10 @@
 package org.apache.atlas.repository.audit;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Singleton;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.ha.HAConfiguration;
 import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.atlas.service.Service;
@@ -47,7 +47,9 @@
 import org.apache.hadoop.hbase.util.Bytes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Singleton;
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -70,6 +72,8 @@
  * But if there are more than one atlas servers, we should use server id in the key
  */
 @Singleton
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl")
 public class HBaseBasedAuditRepository implements Service, EntityAuditRepository, ActiveStateChangeHandler {
     private static final Logger LOG = LoggerFactory.getLogger(HBaseBasedAuditRepository.class);
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/InMemoryEntityAuditRepository.java b/repository/src/main/java/org/apache/atlas/repository/audit/InMemoryEntityAuditRepository.java
index 86f1af7..22d2a81 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/InMemoryEntityAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/InMemoryEntityAuditRepository.java
@@ -18,21 +18,24 @@
 
 package org.apache.atlas.repository.audit;
 
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Singleton;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.EntityAuditEvent;
-
-import com.google.inject.Singleton;
-
 /**
  * Entity audit repository where audit events are stored in-memory. Used only for integration tests
  */
 @Singleton
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl")
 public class InMemoryEntityAuditRepository implements EntityAuditRepository {
     private TreeMap<String, EntityAuditEvent> auditEvents = new TreeMap<>();
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java b/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
index d4d3c20..7c39ce9 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
@@ -18,18 +18,21 @@
 
 package org.apache.atlas.repository.audit;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
+import org.springframework.stereotype.Component;
 
-import com.google.inject.Singleton;
+import javax.inject.Singleton;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * Implementation that completely disables the audit repository.
  */
 @Singleton
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl", isDefault = true)
 public class NoopEntityAuditRepository implements EntityAuditRepository {
 
     @Override
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasAbstractFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasAbstractFormatConverter.java
index a36618c..ab0d1fc 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasAbstractFormatConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasAbstractFormatConverter.java
@@ -21,8 +21,8 @@
 import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.type.AtlasTypeRegistry;
 
-
 public abstract class AtlasAbstractFormatConverter implements AtlasFormatConverter {
+
     protected final AtlasFormatConverters converterRegistry;
     protected final AtlasTypeRegistry     typeRegistry;
     protected final TypeCategory          typeCategory;
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java
index d71d543..734bd0c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java
@@ -28,8 +28,8 @@
 
 import java.util.Map;
 
-
 public class AtlasEnumFormatConverter extends AtlasAbstractFormatConverter {
+
     public AtlasEnumFormatConverter(AtlasFormatConverters registry, AtlasTypeRegistry typeRegistry) {
         super(registry, typeRegistry, TypeCategory.ENUM);
     }
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasFormatConverters.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasFormatConverters.java
index 3a164c8..d519806 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasFormatConverters.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasFormatConverters.java
@@ -17,17 +17,19 @@
  */
 package org.apache.atlas.repository.converters;
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import java.util.HashMap;
 import java.util.Map;
 
 @Singleton
+@Component
 public class AtlasFormatConverters {
 
     private final Map<TypeCategory, AtlasFormatConverter> registry = new HashMap<>();
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
index 6e0766d..3426ae5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
@@ -17,10 +17,7 @@
  */
 package org.apache.atlas.repository.converters;
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.atlas.AtlasClient;
-import org.apache.atlas.AtlasClient.EntityResult;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
@@ -55,7 +52,10 @@
 import org.apache.commons.collections.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -64,19 +64,24 @@
 import java.util.Map;
 
 @Singleton
+@Component
 public class AtlasInstanceConverter {
 
     private static final Logger LOG = LoggerFactory.getLogger(AtlasInstanceConverter.class);
 
-    @Inject
     private AtlasTypeRegistry typeRegistry;
 
-    @Inject
     private AtlasFormatConverters instanceFormatters;
 
-    @Inject
     private MetadataService metadataService;
 
+    @Inject
+    public AtlasInstanceConverter(AtlasTypeRegistry typeRegistry, AtlasFormatConverters instanceFormatters, MetadataService metadataService) {
+        this.typeRegistry = typeRegistry;
+        this.instanceFormatters = instanceFormatters;
+        this.metadataService = metadataService;
+    }
+
     public ITypedReferenceableInstance[] getITypedReferenceables(Collection<AtlasEntity> entities) throws AtlasBaseException {
         ITypedReferenceableInstance[] entitiesInOldFormat = new ITypedReferenceableInstance[entities.size()];
 
@@ -166,7 +171,7 @@
         return ctx.getEntities();
     }
 
-    public static EntityMutationResponse toEntityMutationResponse(AtlasClient.EntityResult entityResult) {
+    public static EntityMutationResponse toEntityMutationResponse(EntityResult entityResult) {
 
         CreateUpdateEntitiesResult result = new CreateUpdateEntitiesResult();
         result.setEntityResult(entityResult);
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java
index f8fa4d5..f946b9c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java
@@ -36,8 +36,7 @@
 
 import java.util.Map;
 
-public class
-AtlasObjectIdConverter extends  AtlasAbstractFormatConverter {
+public class AtlasObjectIdConverter extends  AtlasAbstractFormatConverter {
 
     public AtlasObjectIdConverter(AtlasFormatConverters registry, AtlasTypeRegistry typeRegistry) {
         this(registry, typeRegistry, TypeCategory.OBJECT_ID_TYPE);
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasPrimitiveFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasPrimitiveFormatConverter.java
index d0e63eb..dc29689 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasPrimitiveFormatConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasPrimitiveFormatConverter.java
@@ -23,8 +23,8 @@
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 
-
 public class AtlasPrimitiveFormatConverter extends AtlasAbstractFormatConverter {
+
     public AtlasPrimitiveFormatConverter(AtlasFormatConverters registry, AtlasTypeRegistry typeRegistry) {
         super(registry, typeRegistry, TypeCategory.PRIMITIVE);
     }
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
index 0c5cac6..323af40 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
@@ -18,17 +18,19 @@
 
 package org.apache.atlas.repository.graph;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.GraphDatabase;
 import org.apache.atlas.util.AtlasRepositoryConfiguration;
-
-import com.google.common.annotations.VisibleForTesting;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 
 /**
  * Provides access to the AtlasGraph
  *
  */
+@Configuration
 public class AtlasGraphProvider implements IAtlasGraphProvider {
 
     private static volatile GraphDatabase<?,?> graphDb_;    
@@ -64,6 +66,7 @@
     }
 
     @Override
+    @Bean
     public AtlasGraph get() throws RepositoryException {
         return getGraphInstance();
     }
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java b/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
index a60ef9e..1ed12bc 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
@@ -17,8 +17,6 @@
  */
 package org.apache.atlas.repository.graph;
 
-import com.google.inject.Singleton;
-import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasClassification;
@@ -34,6 +32,7 @@
 import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.util.HashSet;
@@ -42,7 +41,7 @@
 import java.util.Set;
 
 
-@Singleton
+@Component
 public class FullTextMapperV2 {
     private static final Logger LOG = LoggerFactory.getLogger(FullTextMapperV2.class);
 
@@ -53,20 +52,9 @@
     private final boolean              followReferences;
 
     @Inject
-    public FullTextMapperV2(AtlasTypeRegistry typeRegistry) {
+    public FullTextMapperV2(AtlasTypeRegistry typeRegistry, Configuration configuration) {
         entityGraphRetriever = new EntityGraphRetriever(typeRegistry);
-
-        Configuration configuration = null;
-
-        try {
-            configuration = ApplicationProperties.get();
-        } catch (Throwable e) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("AtlasApplication properties couldn't be loaded", e);
-            }
-        } finally {
-            followReferences = configuration != null && configuration.getBoolean(FULL_TEXT_FOLLOW_REFERENCES, false);
-        }
+        followReferences = configuration != null && configuration.getBoolean(FULL_TEXT_FOLLOW_REFERENCES, false);
     }
 
     /**
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
index d1e8cb7..5bec8fa 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
@@ -18,23 +18,13 @@
 
 package org.apache.atlas.repository.graph;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.atlas.AtlasClient;
+import com.google.common.base.Preconditions;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.GraphTransaction;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.repository.RepositoryException;
@@ -55,16 +45,18 @@
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.util.*;
 
 /**
  * An implementation backed by a Graph database provided
  * as a Graph Service.
  */
 @Singleton
+@Component
 @Deprecated
 public class GraphBackedMetadataRepository implements MetadataRepository {
 
@@ -76,24 +68,16 @@
 
     private DeleteHandler deleteHandler;
 
-    private final IAtlasGraphProvider graphProvider;
+    private final AtlasGraph atlasGraph;
     private final GraphToTypedInstanceMapper graphToInstanceMapper;
 
     @Inject
-    public GraphBackedMetadataRepository(DeleteHandler deleteHandler) {
-        this.graphProvider = new AtlasGraphProvider();
-        this.graphToInstanceMapper = new GraphToTypedInstanceMapper(graphProvider);
+    public GraphBackedMetadataRepository(DeleteHandler deleteHandler, AtlasGraph atlasGraph) {
+        this.atlasGraph = atlasGraph;
+        this.graphToInstanceMapper = new GraphToTypedInstanceMapper(atlasGraph);
         this.deleteHandler = deleteHandler;
     }
 
-    //for testing only
-    public GraphBackedMetadataRepository(IAtlasGraphProvider graphProvider, DeleteHandler deleteHandler) {
-        this.graphProvider = graphProvider;
-        this.graphToInstanceMapper = new GraphToTypedInstanceMapper(graphProvider);
-        this.deleteHandler = deleteHandler;
-    }
-
-
     public GraphToTypedInstanceMapper getGraphToInstanceMapper() {
         return graphToInstanceMapper;
     }
@@ -161,7 +145,7 @@
             instanceToGraphMapper.mapTypedInstanceToGraph(TypedInstanceToGraphMapper.Operation.CREATE, entities);
             List<String> createdGuids = RequestContext.get().getCreatedEntityIds();
             CreateUpdateEntitiesResult result = new CreateUpdateEntitiesResult();
-            AtlasClient.EntityResult entityResult = new AtlasClient.EntityResult(createdGuids, null,  null);
+            EntityResult entityResult = new EntityResult(createdGuids, null,  null);
             GuidMapping mapping = instanceToGraphMapper.createGuidMapping();
             result.setEntityResult(entityResult);
             result.setGuidMapping(mapping);
@@ -174,6 +158,7 @@
     }
 
     @Override
+    @GraphTransaction
     public ITypedReferenceableInstance getEntityDefinition(String guid) throws RepositoryException, EntityNotFoundException {
         return getEntityDefinitions(guid).get(0);
     }
@@ -469,7 +454,7 @@
 
     @Override
     @GraphTransaction
-    public AtlasClient.EntityResult deleteEntities(List<String> guids) throws RepositoryException {
+    public EntityResult deleteEntities(List<String> guids) throws RepositoryException {
 
         if (guids == null || guids.size() == 0) {
             throw new IllegalArgumentException("guids must be non-null and non-empty");
@@ -491,7 +476,7 @@
 
         if (deletionCandidates.isEmpty()) {
             LOG.info("No deletion candidate entities were found for guids %s", guids);
-            return new AtlasClient.EntityResult(Collections.<String>emptyList(), Collections.<String>emptyList(), Collections.<String>emptyList());
+            return new EntityResult(Collections.<String>emptyList(), Collections.<String>emptyList(), Collections.<String>emptyList());
         }
 
         try {
@@ -505,14 +490,14 @@
         return createEntityResultFromContext(requestContext);
     }
 
-    private AtlasClient.EntityResult createEntityResultFromContext(RequestContext requestContext) {
-        return new AtlasClient.EntityResult(
+    private EntityResult createEntityResultFromContext(RequestContext requestContext) {
+        return new EntityResult(
                 requestContext.getCreatedEntityIds(),
                 requestContext.getUpdatedEntityIds(),
                 requestContext.getDeletedEntityIds());
     }
 
     public AtlasGraph getGraph() throws RepositoryException {
-        return graphProvider.get();
+        return atlasGraph;
     }
 }
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 9b921f9..35dbf6c 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -60,6 +60,7 @@
 import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.math.BigDecimal;
@@ -76,6 +77,7 @@
 /**
  * Adds index for properties of a given type when its added before any instances are added.
  */
+@Component
 public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChangeHandler,
         TypeDefChangeListener {
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
index 8b03b6a..e877680 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
@@ -22,6 +22,7 @@
 import org.apache.atlas.setup.SetupStep;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 /**
  * A {@link SetupStep} that initializes the Graph backend for Atlas.
@@ -29,6 +30,7 @@
  * This class will initialize the specific backend implementation specified in
  * the Atlas configuration for the key atlas.graph.storage.backend.
  */
+@Component
 public class GraphSchemaInitializer implements SetupStep {
 
     private static final Logger LOG = LoggerFactory.getLogger(GraphSchemaInitializer.class);
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
index 3a54e3e..bbacb14 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
@@ -17,20 +17,10 @@
  */
 package org.apache.atlas.repository.graph;
 
-import static org.apache.atlas.repository.graph.GraphHelper.string;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContext;
-import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.Constants;
+import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -50,10 +40,20 @@
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import com.google.inject.Singleton;
+import javax.inject.Inject;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
-@Singleton
+import static org.apache.atlas.repository.graph.GraphHelper.string;
+
+@Component
 @Deprecated
 public final class GraphToTypedInstanceMapper {
 
@@ -61,10 +61,11 @@
     private static TypeSystem typeSystem = TypeSystem.getInstance();
     private static final GraphHelper graphHelper = GraphHelper.getInstance();
 
-    private final IAtlasGraphProvider graphProvider;
+    private final AtlasGraph atlasGraph;
 
-    public GraphToTypedInstanceMapper(IAtlasGraphProvider graphProvider) {
-        this.graphProvider = graphProvider;
+    @Inject
+    public GraphToTypedInstanceMapper(AtlasGraph atlasGraph) {
+        this.atlasGraph = atlasGraph;
     }
 
     public ITypedReferenceableInstance mapGraphToTypedInstance(String guid, AtlasVertex instanceVertex)
@@ -448,7 +449,7 @@
     }
 
     private AtlasGraph getGraph() throws RepositoryException {
-        return graphProvider.get();
+        return atlasGraph;
     }
 }
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/HardDeleteHandler.java b/repository/src/main/java/org/apache/atlas/repository/graph/HardDeleteHandler.java
index 78cf946..e00ef96 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/HardDeleteHandler.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/HardDeleteHandler.java
@@ -18,12 +18,17 @@
 
 package org.apache.atlas.repository.graph;
 
-import com.google.inject.Inject;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.typesystem.types.TypeSystem;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.DeleteHandler.impl")
 public class HardDeleteHandler extends DeleteHandler {
 
     @Inject
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/SoftDeleteHandler.java b/repository/src/main/java/org/apache/atlas/repository/graph/SoftDeleteHandler.java
index dc21291..b37fe75 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/SoftDeleteHandler.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/SoftDeleteHandler.java
@@ -18,19 +18,25 @@
 
 package org.apache.atlas.repository.graph;
 
-import com.google.inject.Inject;
-import org.apache.atlas.repository.graphdb.AtlasEdge;
-import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
+import org.apache.atlas.repository.graphdb.AtlasEdge;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.types.TypeSystem;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
 
 import static org.apache.atlas.repository.Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.MODIFIED_BY_KEY;
 import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY;
 
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.DeleteHandler.impl", isDefault = true)
 public class SoftDeleteHandler extends DeleteHandler {
+
     @Inject
     public SoftDeleteHandler(TypeSystem typeSystem) {
         super(typeSystem, false, true);
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java
index c3e25bd..4dac293 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java
@@ -17,19 +17,8 @@
  */
 package org.apache.atlas.repository.graph;
 
-import static org.apache.atlas.repository.graph.GraphHelper.string;
-
-import java.security.MessageDigest;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.model.instance.GuidMapping;
@@ -46,27 +35,30 @@
 import org.apache.atlas.typesystem.exception.EntityNotFoundException;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
-import org.apache.atlas.typesystem.types.AttributeInfo;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
+import org.apache.atlas.typesystem.types.*;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
-import org.apache.atlas.typesystem.types.EnumValue;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.ObjectGraphWalker;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.TypeUtils;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
 import org.apache.atlas.util.AtlasRepositoryConfiguration;
 import org.apache.atlas.utils.MD5Utils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
+import javax.inject.Inject;
+import java.security.MessageDigest;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+import static org.apache.atlas.repository.graph.GraphHelper.string;
+
+@Component
 @Deprecated
 public final class TypedInstanceToGraphMapper {
 
@@ -473,8 +465,8 @@
                                              IDataType entryType, AttributeInfo attributeInfo) throws AtlasException {
         if (currentEntries != null && !currentEntries.isEmpty()) {
             LOG.debug("Removing unused entries from the old collection");
-            if (entryType.getTypeCategory() == DataTypes.TypeCategory.STRUCT
-                    || entryType.getTypeCategory() == DataTypes.TypeCategory.CLASS) {
+            if (entryType.getTypeCategory() == TypeCategory.STRUCT
+                    || entryType.getTypeCategory() == TypeCategory.CLASS) {
 
                 //Remove the edges for (current edges - new edges)
                 List<AtlasEdge> cloneElements = new ArrayList<>(currentEntries);
@@ -840,7 +832,7 @@
             if (dateVal != null) {
                 propertyValue = dateVal.getTime();
             }
-        } else if (attributeInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ENUM) {
+        } else if (attributeInfo.dataType().getTypeCategory() == TypeCategory.ENUM) {
             if (attrValue != null) {
                 propertyValue = ((EnumValue) attrValue).value;
             }
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
index 2f298ba..7744c78 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
@@ -35,7 +35,6 @@
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.store.graph.v1.EntityGraphRetriever;
 import org.apache.atlas.type.AtlasArrayType;
@@ -55,7 +54,9 @@
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
 import java.util.ArrayList;
@@ -68,6 +69,7 @@
 
 import static org.apache.atlas.model.impexp.AtlasExportRequest.*;
 
+@Component
 public class ExportService {
     private static final Logger LOG = LoggerFactory.getLogger(ExportService.class);
 
@@ -76,10 +78,11 @@
     private final EntityGraphRetriever      entityGraphRetriever;
     private final AtlasGremlinQueryProvider gremlinQueryProvider;
 
-    public ExportService(final AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
+    @Inject
+    public ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph atlasGraph) throws AtlasBaseException {
         this.typeRegistry         = typeRegistry;
         this.entityGraphRetriever = new EntityGraphRetriever(this.typeRegistry);
-        this.atlasGraph           = AtlasGraphProvider.getGraphInstance();
+        this.atlasGraph           = atlasGraph;
         this.gremlinQueryProvider = AtlasGremlinQueryProvider.INSTANCE;
     }
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
index 245c1d8..4530f51 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
@@ -33,12 +33,16 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jackson.annotate.JsonAutoDetect;
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -57,10 +61,28 @@
 /**
  * Class that handles initial loading of models and patches into typedef store
  */
+@Service
 public class AtlasTypeDefStoreInitializer {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefStoreInitializer.class);
 
-    public void initializeStore(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, String typesDirName) {
+    private final AtlasTypeDefStore atlasTypeDefStore;
+    private final AtlasTypeRegistry atlasTypeRegistry;
+
+    @Inject
+    public AtlasTypeDefStoreInitializer(AtlasTypeDefStore atlasTypeDefStore, AtlasTypeRegistry atlasTypeRegistry) {
+        this.atlasTypeDefStore = atlasTypeDefStore;
+        this.atlasTypeRegistry = atlasTypeRegistry;
+    }
+
+    @PostConstruct
+    public void init() {
+        String atlasHomeDir = System.getProperty("atlas.home");
+        String typesDirName = (StringUtils.isEmpty(atlasHomeDir) ? "." : atlasHomeDir) + File.separator + "models";
+
+        initializeStore(typesDirName);
+    }
+
+    private void initializeStore(String typesDirName) {
         File   typesDir     = new File(typesDirName);
         File[] typeDefFiles = typesDir.exists() ? typesDir.listFiles() : null;
 
@@ -88,11 +110,11 @@
                     continue;
                 }
 
-                AtlasTypesDef typesToCreate = getTypesToCreate(typesDef, typeRegistry);
-                AtlasTypesDef typesToUpdate = getTypesToUpdate(typesDef, typeRegistry);
+                AtlasTypesDef typesToCreate = getTypesToCreate(typesDef, atlasTypeRegistry);
+                AtlasTypesDef typesToUpdate = getTypesToUpdate(typesDef, atlasTypeRegistry);
 
                 if (!typesToCreate.isEmpty() || !typesToUpdate.isEmpty()) {
-                    typeDefStore.createUpdateTypesDef(typesToCreate, typesToUpdate);
+                    atlasTypeDefStore.createUpdateTypesDef(typesToCreate, typesToUpdate);
 
                     LOG.info("Created/Updated types defined in file {}", typeDefFile.getAbsolutePath());
                 } else {
@@ -104,7 +126,7 @@
             }
         }
 
-        applyTypePatches(typeDefStore, typeRegistry, typesDirName);
+        applyTypePatches(typesDirName);
     }
 
     public static AtlasTypesDef getTypesToCreate(AtlasTypesDef typesDef, AtlasTypeRegistry typeRegistry) {
@@ -239,7 +261,7 @@
         return ObjectUtils.compare(newTypeVersion, oldTypeVersion) > 0;
     }
 
-    private void applyTypePatches(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, String typesDirName) {
+    private void applyTypePatches(String typesDirName) {
         String typePatchesDirName = typesDirName + File.separator + "patches";
         File   typePatchesDir     = new File(typePatchesDirName);
         File[] typePatchFiles     = typePatchesDir.exists() ? typePatchesDir.listFiles() : null;
@@ -254,9 +276,9 @@
         Arrays.sort(typePatchFiles);
 
         PatchHandler[] patchHandlers = new PatchHandler[] {
-                new AddAttributePatchHandler(typeDefStore, typeRegistry),
-                new UpdateTypeDefOptionsPatchHandler(typeDefStore, typeRegistry),
-                new UpdateAttributePatchHandler(typeDefStore, typeRegistry)
+                new AddAttributePatchHandler(atlasTypeDefStore, atlasTypeRegistry),
+                new UpdateTypeDefOptionsPatchHandler(atlasTypeDefStore, atlasTypeRegistry),
+                new UpdateAttributePatchHandler(atlasTypeDefStore, atlasTypeRegistry)
         };
 
         Map<String, PatchHandler> patchHandlerRegistry = new HashMap<>();
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java
index e873e91..a4163f2 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java
@@ -17,12 +17,9 @@
  */
 package org.apache.atlas.repository.store.graph;
 
-
-import org.apache.atlas.GraphTransaction;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.impexp.AtlasImportResult;
 import org.apache.atlas.model.instance.AtlasClassification;
-import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
@@ -132,7 +129,6 @@
      */
     void updateClassifications(String guid, List<AtlasClassification> classifications) throws AtlasBaseException;
 
-    @GraphTransaction
     void addClassification(List<String> guids, AtlasClassification classification) throws AtlasBaseException;
 
     /**
@@ -140,9 +136,7 @@
      */
     void deleteClassifications(String guid, List<String> classificationNames) throws AtlasBaseException;
 
-    @GraphTransaction
     List<AtlasClassification> getClassifications(String guid) throws AtlasBaseException;
 
-    @GraphTransaction
     AtlasClassification getClassification(String guid, String classificationName) throws AtlasBaseException;
 }
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
index 4a8e1de..17b7e17 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
@@ -19,8 +19,8 @@
 
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.GraphTransaction;
 import org.apache.atlas.GraphTransactionInterceptor;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.atlas.listener.ChangedTypeDefs;
@@ -34,7 +34,6 @@
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
-import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
 import org.apache.atlas.repository.util.FilterUtil;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasClassificationType;
@@ -52,7 +51,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -108,8 +106,6 @@
         } finally {
             typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates);
         }
-
-        bootstrapTypes();
     }
 
     @Override
@@ -571,15 +567,6 @@
         LOG.info("Not reacting to a Passive state change");
     }
 
-    private void bootstrapTypes() {
-        AtlasTypeDefStoreInitializer storeInitializer = new AtlasTypeDefStoreInitializer();
-
-        String atlasHomeDir = System.getProperty("atlas.home");
-        String typesDirName = (StringUtils.isEmpty(atlasHomeDir) ? "." : atlasHomeDir) + File.separator + "models";
-
-        storeInitializer.initializeStore(this, typeRegistry, typesDirName);
-    }
-
     private AtlasBaseTypeDef getTypeDefFromType(AtlasType type) throws AtlasBaseException {
         AtlasBaseTypeDef ret;
         switch (type.getTypeCategory()) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
index d9bc924..6423aea 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
@@ -18,8 +18,6 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -30,7 +28,8 @@
 import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
-import org.apache.atlas.repository.graph.*;
+import org.apache.atlas.repository.graph.FullTextMapperV2;
+import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
@@ -39,14 +38,16 @@
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
 
-@Singleton
+@Component
 public class AtlasEntityChangeNotifier {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityChangeNotifier.class);
 
@@ -101,7 +102,7 @@
             try {
                 listener.onTraitsAdded(entity, traits);
             } catch (AtlasException e) {
-                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e);
+                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), "TraitAdd");
             }
         }
     }
@@ -120,7 +121,7 @@
             try {
                 listener.onTraitsDeleted(entity, traitNames);
             } catch (AtlasException e) {
-                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e);
+                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), "TraitDelete");
             }
         }
     }
@@ -140,11 +141,15 @@
             try {
                 listener.onTraitsUpdated(entity, traits);
             } catch (AtlasException e) {
-                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e);
+                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), "TraitUpdate");
             }
         }
     }
 
+    private String getListenerName(EntityChangeListener listener) {
+        return listener.getClass().getSimpleName();
+    }
+
     private void notifyListeners(List<AtlasEntityHeader> entityHeaders, EntityOperation operation, boolean isImport) throws AtlasBaseException {
         if (CollectionUtils.isEmpty(entityHeaders)) {
             return;
@@ -167,7 +172,7 @@
                         break;
                 }
             } catch (AtlasException e) {
-                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, operation.toString());
+                throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), operation.toString());
             }
         }
     }
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
index 1bfe3b9..8046234 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
@@ -17,7 +17,6 @@
  */
 package org.apache.atlas.repository.store.graph.v1;
 
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
@@ -32,6 +31,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
index 70a904b..27c0b5d 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
@@ -18,11 +18,9 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.GraphTransaction;
 import org.apache.atlas.RequestContextV1;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.impexp.AtlasImportResult;
 import org.apache.atlas.model.instance.AtlasClassification;
@@ -47,7 +45,9 @@
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -61,19 +61,22 @@
 import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.UPDATE;
 
 
-@Singleton
+@Component
 public class AtlasEntityStoreV1 implements AtlasEntityStore {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityStoreV1.class);
 
     private final DeleteHandlerV1           deleteHandler;
     private final AtlasTypeRegistry         typeRegistry;
     private final AtlasEntityChangeNotifier entityChangeNotifier;
+    private final EntityGraphMapper entityGraphMapper;
 
     @Inject
-    public AtlasEntityStoreV1(DeleteHandlerV1 deleteHandler, AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier) {
+    public AtlasEntityStoreV1(DeleteHandlerV1 deleteHandler, AtlasTypeRegistry typeRegistry,
+                              AtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper) {
         this.deleteHandler        = deleteHandler;
         this.typeRegistry         = typeRegistry;
         this.entityChangeNotifier = entityChangeNotifier;
+        this.entityGraphMapper = entityGraphMapper;
     }
 
     @Override
@@ -143,6 +146,7 @@
     }
 
     @Override
+    @GraphTransaction
     public EntityMutationResponse bulkImport(EntityImportStream entityStream, AtlasImportResult importResult) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> bulkImport()");
@@ -208,7 +212,6 @@
         }
     }
 
-    @GraphTransaction
     private EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate, boolean replaceClassifications) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> createOrUpdate()");
@@ -219,8 +222,6 @@
         }
 
         // Create/Update entities
-        EntityGraphMapper entityGraphMapper = new EntityGraphMapper(deleteHandler, typeRegistry);
-
         EntityMutationContext context = preCreateOrUpdate(entityStream, entityGraphMapper, isPartialUpdate);
 
         EntityMutationResponse ret = entityGraphMapper.mapAttributesAndClassifications(context, isPartialUpdate, replaceClassifications);
@@ -238,6 +239,7 @@
     }
 
     @Override
+    @GraphTransaction
     public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException {
         return createOrUpdate(entityStream, isPartialUpdate, false);
     }
@@ -315,6 +317,7 @@
         return createOrUpdate(new AtlasEntityStream(updateEntity), true);
     }
 
+    @Override
     @GraphTransaction
     public EntityMutationResponse deleteById(final String guid) throws AtlasBaseException {
 
@@ -432,8 +435,7 @@
         // validate if entity, not already associated with classifications
         validateEntityAssociations(guid, classifications);
 
-        EntityGraphMapper graphMapper = new EntityGraphMapper(deleteHandler, typeRegistry);
-        graphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
+        entityGraphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
 
         // notify listeners on classification addition
         entityChangeNotifier.onClassificationAddedToEntity(guid, classifications);
@@ -454,7 +456,6 @@
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "classifications(s) not specified");
         }
 
-        EntityGraphMapper         graphMapper            = new EntityGraphMapper(deleteHandler, typeRegistry);
         List<AtlasClassification> updatedClassifications = new ArrayList<>();
 
         for (AtlasClassification newClassification : newClassifications) {
@@ -475,7 +476,7 @@
                 }
             }
 
-            graphMapper.updateClassification(new EntityMutationContext(), guid, oldClassification);
+            entityGraphMapper.updateClassification(new EntityMutationContext(), guid, oldClassification);
 
             updatedClassifications.add(oldClassification);
         }
@@ -498,8 +499,6 @@
             LOG.debug("Adding classification={} to entities={}", classification, guids);
         }
 
-        EntityGraphMapper graphMapper = new EntityGraphMapper(deleteHandler, typeRegistry);
-
         validateAndNormalize(classification);
 
         List<AtlasClassification> classifications = Collections.singletonList(classification);
@@ -508,7 +507,7 @@
             // validate if entity, not already associated with classifications
             validateEntityAssociations(guid, classifications);
 
-            graphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
+            entityGraphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
 
             // notify listeners on classification addition
             entityChangeNotifier.onClassificationAddedToEntity(guid, classifications);
@@ -530,7 +529,6 @@
             LOG.debug("Deleting classifications={} from entity={}", classificationNames, guid);
         }
 
-        EntityGraphMapper entityGraphMapper = new EntityGraphMapper(deleteHandler, typeRegistry);
         entityGraphMapper.deleteClassifications(guid, classificationNames);
 
         // notify listeners on classification deletion
@@ -569,7 +567,7 @@
             AtlasEntity entity = entityStream.getByGuid(guid);
 
             if (entity != null) {
-                
+
                 if (vertex != null) {
                     // entity would be null if guid is not in the stream but referenced by an entity in the stream
                     if (!isPartialUpdate) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStream.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStream.java
index eb860ff..d6d6272 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStream.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStream.java
@@ -18,8 +18,8 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 
 import java.util.Iterator;
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index 3bf318f..f0c8380 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -19,14 +19,11 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.TypeDefChangeListener;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -43,7 +40,11 @@
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -59,15 +60,19 @@
 /**
  * Graph persistence store for TypeDef - v1
  */
+@Singleton
+@Component
 public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStoreV1.class);
 
-    protected final AtlasGraph atlasGraph = AtlasGraphProvider.getGraphInstance();
+    protected final AtlasGraph atlasGraph;
 
     @Inject
     public AtlasTypeDefGraphStoreV1(AtlasTypeRegistry typeRegistry,
-                                    Set<TypeDefChangeListener> typeDefChangeListeners) {
+                                    Set<TypeDefChangeListener> typeDefChangeListeners,
+                                    AtlasGraph atlasGraph) {
         super(typeRegistry, typeDefChangeListeners);
+        this.atlasGraph = atlasGraph;
 
         LOG.debug("==> AtlasTypeDefGraphStoreV1()");
 
@@ -105,6 +110,7 @@
     }
 
     @Override
+    @PostConstruct
     public void init() throws AtlasBaseException {
         LOG.debug("==> AtlasTypeDefGraphStoreV1.init()");
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
index 0fe748e..80cd1ee 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
@@ -18,7 +18,6 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContextV1;
@@ -29,9 +28,8 @@
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.model.instance.AtlasStruct;
-import org.apache.atlas.model.instance.EntityMutations;
-import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.model.instance.EntityMutationResponse;
+import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
@@ -45,48 +43,42 @@
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasMapType;
 import org.apache.atlas.type.AtlasStructType;
+import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.type.AtlasTypeUtil;
-import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
+import javax.inject.Inject;
+import java.util.*;
 
 import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.CREATE;
+import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.DELETE;
 import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.PARTIAL_UPDATE;
 import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.UPDATE;
-import static org.apache.atlas.model.instance.EntityMutations.EntityOperation.DELETE;
 import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY;
 import static org.apache.atlas.repository.graph.GraphHelper.string;
 
-
+@Component
 public class EntityGraphMapper {
     private static final Logger LOG = LoggerFactory.getLogger(EntityGraphMapper.class);
 
-    private final AtlasGraph        graph       = AtlasGraphProvider.getGraphInstance();
     private final GraphHelper       graphHelper = GraphHelper.getInstance();
+    private final AtlasGraph        graph;
     private final DeleteHandlerV1   deleteHandler;
     private final AtlasTypeRegistry typeRegistry;
 
 
     @Inject
-    public EntityGraphMapper(DeleteHandlerV1 deleteHandler, AtlasTypeRegistry typeRegistry) {
+    public EntityGraphMapper(DeleteHandlerV1 deleteHandler, AtlasTypeRegistry typeRegistry, AtlasGraph atlasGraph) {
         this.deleteHandler = deleteHandler;
         this.typeRegistry  = typeRegistry;
+        this.graph         = atlasGraph;
     }
 
     public AtlasVertex createVertex(AtlasEntity entity) {
@@ -284,7 +276,7 @@
     }
 
     private Object mapToVertexByTypeCategory(AttributeMutationContext ctx, EntityMutationContext context) throws AtlasBaseException {
-        if (ctx.getOp() == EntityMutations.EntityOperation.CREATE && ctx.getValue() == null) {
+        if (ctx.getOp() == CREATE && ctx.getValue() == null) {
             return null;
         }
 
@@ -509,7 +501,7 @@
 
         try {
             AtlasAttribute      attribute   = ctx.getAttribute();
-            List<String>        currentKeys = GraphHelper.getListProperty(ctx.getReferringVertex(), ctx.getVertexProperty());
+            List<String> currentKeys = GraphHelper.getListProperty(ctx.getReferringVertex(), ctx.getVertexProperty());
             Map<String, Object> currentMap  = new HashMap<>();
 
             if (CollectionUtils.isNotEmpty(currentKeys)) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
index da6d636..66f20da 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
@@ -289,16 +289,16 @@
         List<String> classificationNames = GraphHelper.getTraitNames(instanceVertex);
 
         if (CollectionUtils.isNotEmpty(classificationNames)) {
-            for (String classficationName : classificationNames) {
-                AtlasClassification classification = null;
+            for (String classificationName : classificationNames) {
+                AtlasClassification classification;
                 if (StringUtils.isNotEmpty(classificationNameFilter)) {
-                    if (classficationName.equals(classificationNameFilter)) {
-                        classification = getClassification(instanceVertex, classficationName);
+                    if (classificationName.equals(classificationNameFilter)) {
+                        classification = getClassification(instanceVertex, classificationName);
                         classifications.add(classification);
                         return classifications;
                     }
                 } else {
-                    classification = getClassification(instanceVertex, classficationName);
+                    classification = getClassification(instanceVertex, classificationName);
                     classifications.add(classification);
                 }
             }
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1.java
index f51238a..29518c4 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1.java
@@ -18,12 +18,17 @@
 
 package org.apache.atlas.repository.store.graph.v1;
 
-import com.google.inject.Inject;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.DeleteHandlerV1.impl")
 public class HardDeleteHandlerV1 extends DeleteHandlerV1 {
 
     @Inject
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
index 31bb24a..49c9e0c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
@@ -18,21 +18,24 @@
 
 package org.apache.atlas.repository.store.graph.v1;
 
-import com.google.inject.Inject;
 import org.apache.atlas.RequestContextV1;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.RequestContext;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.persistence.Id;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
 
 import static org.apache.atlas.repository.Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.MODIFIED_BY_KEY;
 import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY;
 
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.DeleteHandlerV1.impl", isDefault = true)
 public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
 
     @Inject
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/UniqAttrBasedEntityResolver.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/UniqAttrBasedEntityResolver.java
index c80639a..50eee72 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/UniqAttrBasedEntityResolver.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/UniqAttrBasedEntityResolver.java
@@ -20,31 +20,22 @@
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
-import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext;
 import org.apache.atlas.repository.store.graph.EntityResolver;
 import org.apache.atlas.type.AtlasEntityType;
-import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.exception.EntityNotFoundException;
-import org.apache.commons.collections.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 
 public class UniqAttrBasedEntityResolver implements EntityResolver {
     private static final Logger LOG = LoggerFactory.getLogger(UniqAttrBasedEntityResolver.class);
 
-    private final static GraphHelper graphHelper = GraphHelper.getInstance();
-
     private final AtlasTypeRegistry typeRegistry;
 
     public UniqAttrBasedEntityResolver(AtlasTypeRegistry typeRegistry) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
index ac13586..7a064b6 100644
--- a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
@@ -22,13 +22,10 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.GraphTransaction;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
@@ -41,7 +38,10 @@
 import org.codehaus.jettison.json.JSONException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -53,6 +53,7 @@
 import static org.apache.atlas.repository.graph.GraphHelper.setProperty;
 
 @Singleton
+@Component
 @Deprecated
 public class GraphBackedTypeStore implements ITypeStore {
     public static final String VERTEX_TYPE = "typeSystem";
@@ -66,8 +67,8 @@
     private GraphHelper graphHelper = GraphHelper.getInstance();
 
     @Inject
-    public GraphBackedTypeStore() {
-        graph = AtlasGraphProvider.getGraphInstance();
+    public GraphBackedTypeStore(AtlasGraph atlasGraph) {
+        this.graph = atlasGraph;
     }
 
     @Override
@@ -123,7 +124,7 @@
         List<AtlasVertex> vertices = createVertices(typeVerticesNeeded);
 
         //Create a type name->AtlasVertex map with the result
-        Map<String, AtlasVertex> result = new HashMap<String,AtlasVertex>(typeVerticesNeeded.size());
+        Map<String, AtlasVertex> result = new HashMap<>(typeVerticesNeeded.size());
         for(int i = 0 ; i < typeVerticesNeeded.size(); i++) {
             TypeVertexInfo createdVertexInfo = typeVerticesNeeded.get(i);
             AtlasVertex createdVertex = vertices.get(i);
@@ -357,7 +358,6 @@
 
         List<AtlasVertex> result = new ArrayList<>(infoList.size());
         List<String> typeNames = Lists.transform(infoList, new Function<TypeVertexInfo,String>() {
-
             @Override
             public String apply(TypeVertexInfo input) {
                 return input.getTypeName();
diff --git a/repository/src/main/java/org/apache/atlas/repository/typestore/StoreBackedTypeCache.java b/repository/src/main/java/org/apache/atlas/repository/typestore/StoreBackedTypeCache.java
index 8573719..f472fa6 100644
--- a/repository/src/main/java/org/apache/atlas/repository/typestore/StoreBackedTypeCache.java
+++ b/repository/src/main/java/org/apache/atlas/repository/typestore/StoreBackedTypeCache.java
@@ -17,14 +17,9 @@
  */
 package org.apache.atlas.repository.typestore;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableList;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.types.AttributeDefinition;
 import org.apache.atlas.typesystem.types.ClassType;
@@ -38,10 +33,16 @@
 import org.apache.atlas.typesystem.types.TypeUtils;
 import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
+import org.springframework.stereotype.Component;
 
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -52,7 +53,9 @@
  * are also loaded from the store if they are not already in the cache.
  */
 @Singleton
+@Component
 @Deprecated
+@ConditionalOnAtlasProperty(property = "atlas.TypeCache.impl")
 public class StoreBackedTypeCache extends DefaultTypeCache {
 
     private ITypeStore typeStore;
diff --git a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
index fd85ef0..99d2107 100755
--- a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
+++ b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
@@ -20,8 +20,6 @@
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
-import com.google.inject.Provider;
-import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
@@ -35,6 +33,7 @@
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.listener.TypeDefChangeListener;
 import org.apache.atlas.listener.TypesChangeListener;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.audit.EntityAuditRepository;
@@ -54,16 +53,7 @@
 import org.apache.atlas.typesystem.json.TypesSerialization;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
-import org.apache.atlas.typesystem.types.AttributeInfo;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
+import org.apache.atlas.typesystem.types.*;
 import org.apache.atlas.typesystem.types.cache.TypeCache;
 import org.apache.atlas.utils.ParamChecker;
 import org.apache.commons.configuration.Configuration;
@@ -71,6 +61,7 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -80,6 +71,7 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 
 
@@ -88,6 +80,7 @@
  * for listening to changes to the repository.
  */
 @Singleton
+@Component
 @Deprecated
 public class DefaultMetadataService implements MetadataService, ActiveStateChangeHandler, TypeDefChangeListener {
     private enum OperationType {
@@ -106,24 +99,16 @@
     private final Collection<TypesChangeListener> typeChangeListeners = new LinkedHashSet<>();
     private final Collection<EntityChangeListener> entityChangeListeners = new LinkedHashSet<>();
 
-    @Inject
     private EntityAuditRepository auditRepository;
 
     @Inject
-    DefaultMetadataService(final MetadataRepository repository, final ITypeStore typeStore,
-                           final Collection<Provider<TypesChangeListener>> typeListenerProviders,
-                           final Collection<Provider<EntityChangeListener>> entityListenerProviders, TypeCache typeCache)
-            throws AtlasException {
-        this(repository, typeStore, typeListenerProviders, entityListenerProviders,
-                TypeSystem.getInstance(), ApplicationProperties.get(), typeCache);
-    }
-    
-    //for testing only
     public DefaultMetadataService(final MetadataRepository repository, final ITypeStore typeStore,
-                           final Collection<Provider<TypesChangeListener>> typeListenerProviders,
-                           final Collection<Provider<EntityChangeListener>> entityListenerProviders,
-                           final TypeSystem typeSystem,
-                           final Configuration configuration, TypeCache typeCache) throws AtlasException {
+                                  final Set<TypesChangeListener> typesChangeListeners,
+                                  final Set<EntityChangeListener> entityChangeListeners,
+                                  final TypeSystem typeSystem,
+                                  final Configuration configuration,
+                                  TypeCache typeCache,
+                                  EntityAuditRepository auditRepository) throws AtlasException {
         this.typeStore = typeStore;
         this.typeSystem = typeSystem;
         /**
@@ -139,19 +124,17 @@
 
         this.repository = repository;
 
-        for (Provider<TypesChangeListener> provider : typeListenerProviders) {
-            typeChangeListeners.add(provider.get());
-        }
+        this.typeChangeListeners.addAll(typesChangeListeners);
 
-        for (Provider<EntityChangeListener> provider : entityListenerProviders) {
-            entityChangeListeners.add(provider.get());
-        }
+        this.entityChangeListeners.addAll(entityChangeListeners);
 
         if (!HAConfiguration.isHAEnabled(configuration)) {
             restoreTypeSystem();
         }
 
         maxAuditResults = configuration.getShort(CONFIG_MAX_AUDIT_RESULTS, DEFAULT_MAX_AUDIT_RESULTS);
+
+        this.auditRepository = auditRepository;
     }
 
     private void restoreTypeSystem() throws AtlasException {
@@ -313,7 +296,7 @@
     public ITypedReferenceableInstance[] deserializeClassInstances(String entityInstanceDefinition) throws AtlasException {
         return GraphHelper.deserializeClassInstances(typeSystem, entityInstanceDefinition);
     }
-    
+
     @Override
     public ITypedReferenceableInstance getTypedReferenceableInstance(Referenceable entityInstance) throws AtlasException {
         return GraphHelper.getTypedReferenceableInstance(typeSystem, entityInstance);
@@ -356,7 +339,7 @@
         return repository.getEntityDefinition(entityType, attribute, value);
     }
 
-        @Override
+    @Override
     public String getEntityDefinition(String entityType, String attribute, String value) throws AtlasException {
         final ITypedReferenceableInstance instance = getEntityDefinitionReference(entityType, attribute, value);
         return InstanceSerialization.toJson(instance, true);
@@ -422,7 +405,7 @@
         return result;
     }
 
-    private void onEntitiesAddedUpdated(AtlasClient.EntityResult entityResult) throws AtlasException {
+    private void onEntitiesAddedUpdated(EntityResult entityResult) throws AtlasException {
         onEntitiesAdded(entityResult.getCreatedEntities());
         onEntitiesUpdated(entityResult.getUpdateEntities());
         //Note: doesn't access deletedEntities from entityResult
@@ -635,8 +618,8 @@
 
         // ensure trait is not already defined
         Preconditions
-            .checkArgument(!getTraitNames(guid).contains(traitName), "trait=%s is already defined for entity=%s",
-                    traitName, guid);
+                .checkArgument(!getTraitNames(guid).contains(traitName), "trait=%s is already defined for entity=%s",
+                        traitName, guid);
 
         repository.addTrait(guid, traitInstance);
 
@@ -644,7 +627,7 @@
     }
 
     private ITypedStruct deserializeTraitInstance(String traitInstanceDefinition)
-    throws AtlasException {
+            throws AtlasException {
         return createTraitInstance(InstanceSerialization.fromJsonStruct(traitInstanceDefinition, true));
     }
 
@@ -762,14 +745,14 @@
      * @see org.apache.atlas.services.MetadataService#deleteEntities(java.lang.String)
      */
     @Override
-    public AtlasClient.EntityResult deleteEntities(List<String> deleteCandidateGuids) throws AtlasException {
+    public EntityResult deleteEntities(List<String> deleteCandidateGuids) throws AtlasException {
         ParamChecker.notEmpty(deleteCandidateGuids, "delete candidate guids");
         return deleteGuids(deleteCandidateGuids);
     }
 
     @Override
-    public AtlasClient.EntityResult deleteEntityByUniqueAttribute(String typeName, String uniqueAttributeName,
-                                                                  String attrValue) throws AtlasException {
+    public EntityResult deleteEntityByUniqueAttribute(String typeName, String uniqueAttributeName,
+                                                      String attrValue) throws AtlasException {
         typeName            = ParamChecker.notEmpty(typeName, "delete candidate typeName");
         uniqueAttributeName = ParamChecker.notEmpty(uniqueAttributeName, "delete candidate unique attribute name");
         attrValue           = ParamChecker.notEmpty(attrValue, "delete candidate unique attribute value");
@@ -782,8 +765,8 @@
         return deleteGuids(deleteCandidateGuids);
     }
 
-    private AtlasClient.EntityResult deleteGuids(List<String> deleteCandidateGuids) throws AtlasException {
-        AtlasClient.EntityResult entityResult = repository.deleteEntities(deleteCandidateGuids);
+    private EntityResult deleteGuids(List<String> deleteCandidateGuids) throws AtlasException {
+        EntityResult entityResult = repository.deleteEntities(deleteCandidateGuids);
         onEntitiesAddedUpdated(entityResult);
         return entityResult;
     }
diff --git a/repository/src/main/java/org/apache/atlas/services/MetricsService.java b/repository/src/main/java/org/apache/atlas/services/MetricsService.java
index e3bedb8..0fa68b2 100644
--- a/repository/src/main/java/org/apache/atlas/services/MetricsService.java
+++ b/repository/src/main/java/org/apache/atlas/services/MetricsService.java
@@ -18,12 +18,11 @@
 package org.apache.atlas.services;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Singleton;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.AtlasService;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.metrics.AtlasMetrics;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.util.AtlasGremlinQueryProvider;
 import org.apache.atlas.util.AtlasGremlinQueryProvider.AtlasGremlinQuery;
@@ -35,7 +34,7 @@
 import java.util.List;
 import java.util.Map;
 
-@Singleton
+@AtlasService
 public class MetricsService {
     private static final Logger LOG = LoggerFactory.getLogger(MetricsService.class);
 
@@ -75,8 +74,8 @@
 
 
     @Inject
-    public MetricsService() throws AtlasException {
-        this(ApplicationProperties.get(), AtlasGraphProvider.getGraphInstance());
+    public MetricsService(AtlasGraph atlasGraph) throws AtlasException {
+        this(ApplicationProperties.get(), atlasGraph);
     }
 
     @VisibleForTesting
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
index a4a596a..09f366e 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
@@ -17,18 +17,13 @@
  */
 package org.apache.atlas.util;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.repository.audit.EntityAuditRepository;
 import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.DeleteHandler;
 import org.apache.atlas.repository.graph.SoftDeleteHandler;
 import org.apache.atlas.repository.graphdb.GraphDatabase;
-import org.apache.atlas.repository.graphdb.GremlinVersion;
 import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
 import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
 import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
@@ -37,6 +32,9 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Atlas configuration for repository project
  *
diff --git a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
index a7cb2e5..7c6b60b 100644
--- a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
@@ -21,7 +21,6 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -45,7 +44,7 @@
 /**
  *  Base Class to set up hive types and instances for tests
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class BaseRepositoryTest {
 
     @Inject
@@ -70,7 +69,6 @@
 
     protected void tearDown() throws Exception {
         TypeSystem.getInstance().reset();
-        AtlasGraphProvider.cleanup();
     }
 
     private void setUpTypes() throws Exception {
diff --git a/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java b/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
index 01081da..506d11c 100755
--- a/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
+++ b/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
@@ -29,7 +29,7 @@
  * Uses TestNG's Guice annotation to load the necessary modules and inject the
  * objects from Guice
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class RepositoryServiceLoadingTest {
 
     @Test
diff --git a/repository/src/test/java/org/apache/atlas/TestModules.java b/repository/src/test/java/org/apache/atlas/TestModules.java
new file mode 100644
index 0000000..095af41
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/TestModules.java
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import com.google.inject.Binder;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.google.inject.matcher.Matchers;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.atlas.annotation.GraphTransaction;
+import org.apache.atlas.discovery.AtlasDiscoveryService;
+import org.apache.atlas.discovery.AtlasLineageService;
+import org.apache.atlas.discovery.DataSetLineageService;
+import org.apache.atlas.discovery.DiscoveryService;
+import org.apache.atlas.discovery.EntityDiscoveryService;
+import org.apache.atlas.discovery.EntityLineageService;
+import org.apache.atlas.discovery.LineageService;
+import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
+import org.apache.atlas.graph.GraphSandboxUtil;
+import org.apache.atlas.listener.EntityChangeListener;
+import org.apache.atlas.listener.TypeDefChangeListener;
+import org.apache.atlas.listener.TypesChangeListener;
+import org.apache.atlas.repository.MetadataRepository;
+import org.apache.atlas.repository.audit.EntityAuditListener;
+import org.apache.atlas.repository.audit.EntityAuditRepository;
+import org.apache.atlas.repository.graph.DeleteHandler;
+import org.apache.atlas.repository.graph.GraphBackedMetadataRepository;
+import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
+import org.apache.atlas.repository.graph.HardDeleteHandler;
+import org.apache.atlas.repository.graph.SoftDeleteHandler;
+import org.apache.atlas.repository.graphdb.AtlasGraph;
+import org.apache.atlas.repository.impexp.ExportService;
+import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
+import org.apache.atlas.repository.store.graph.AtlasEntityStore;
+import org.apache.atlas.repository.store.graph.v1.AtlasEntityChangeNotifier;
+import org.apache.atlas.repository.store.graph.v1.AtlasEntityDefStoreV1;
+import org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1;
+import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1;
+import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
+import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
+import org.apache.atlas.repository.store.graph.v1.HardDeleteHandlerV1;
+import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
+import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
+import org.apache.atlas.repository.typestore.ITypeStore;
+import org.apache.atlas.repository.typestore.StoreBackedTypeCache;
+import org.apache.atlas.service.Service;
+import org.apache.atlas.services.DefaultMetadataService;
+import org.apache.atlas.services.MetadataService;
+import org.apache.atlas.store.AtlasTypeDefStore;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.atlas.typesystem.types.TypeSystem;
+import org.apache.atlas.typesystem.types.cache.TypeCache;
+import org.apache.atlas.util.AtlasRepositoryConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestModules {
+
+    static class MockNotifier implements Provider<AtlasEntityChangeNotifier> {
+        @Override
+        public AtlasEntityChangeNotifier get() {
+            return Mockito.mock(AtlasEntityChangeNotifier.class);
+        }
+    }
+
+    // Test only DI modules
+    public static class TestOnlyModule extends com.google.inject.AbstractModule {
+
+        private static final Logger LOG = LoggerFactory.getLogger(TestOnlyModule.class);
+
+        static class TypeSystemProvider implements Provider<TypeSystem> {
+            @Override
+            public TypeSystem get() {
+                return TypeSystem.getInstance();
+            }
+        }
+
+        static class AtlasConfigurationProvider implements Provider<Configuration> {
+
+            @Override
+            public Configuration get() {
+                try {
+                    return ApplicationProperties.get();
+                } catch (AtlasException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+
+        static class AtlasGraphProvider implements Provider<AtlasGraph> {
+            @Override
+            public AtlasGraph get() {
+                return org.apache.atlas.repository.graph.AtlasGraphProvider.getGraphInstance();
+            }
+        }
+
+        @Override
+        protected void configure() {
+            GraphSandboxUtil.create();
+
+            bindAuditRepository(binder());
+
+            bindDeleteHandler(binder());
+
+            bind(AtlasGraph.class).toProvider(AtlasGraphProvider.class);
+
+            // allow for dynamic binding of the metadata repo & graph service
+            // bind the MetadataRepositoryService interface to an implementation
+            bind(MetadataRepository.class).to(GraphBackedMetadataRepository.class).asEagerSingleton();
+
+            bind(TypeSystem.class).toProvider(TypeSystemProvider.class).in(Singleton.class);
+            bind(Configuration.class).toProvider(AtlasConfigurationProvider.class).in(Singleton.class);
+
+            // bind the ITypeStore interface to an implementation
+            bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton();
+            bind(AtlasTypeDefStore.class).to(AtlasTypeDefGraphStoreV1.class).asEagerSingleton();
+
+            //For testing
+            bind(AtlasEntityDefStore.class).to(AtlasEntityDefStoreV1.class).asEagerSingleton();
+            bind(AtlasTypeRegistry.class).asEagerSingleton();
+            bind(EntityGraphMapper.class).asEagerSingleton();
+            bind(ExportService.class).asEagerSingleton();
+
+            //GraphBackedSearchIndexer must be an eager singleton to force the search index creation to happen before
+            //we try to restore the type system (otherwise we'll end up running queries
+            //before we have any indices during the initial graph setup)
+            Multibinder<TypesChangeListener> typesChangeListenerBinder =
+                    Multibinder.newSetBinder(binder(), TypesChangeListener.class);
+            typesChangeListenerBinder.addBinding().to(GraphBackedSearchIndexer.class).asEagerSingleton();
+
+            // New typesdef/instance change listener should also be bound to the corresponding implementation
+            Multibinder<TypeDefChangeListener> typeDefChangeListenerMultibinder =
+                    Multibinder.newSetBinder(binder(), TypeDefChangeListener.class);
+            typeDefChangeListenerMultibinder.addBinding().to(DefaultMetadataService.class);
+            typeDefChangeListenerMultibinder.addBinding().to(GraphBackedSearchIndexer.class).asEagerSingleton();
+
+            bind(AtlasEntityStore.class).to(AtlasEntityStoreV1.class);
+
+            // bind the MetadataService interface to an implementation
+            bind(MetadataService.class).to(DefaultMetadataService.class).asEagerSingleton();
+
+            // bind the DiscoveryService interface to an implementation
+            bind(DiscoveryService.class).to(GraphBackedDiscoveryService.class).asEagerSingleton();
+            bind(AtlasDiscoveryService.class).to(EntityDiscoveryService.class).asEagerSingleton();
+
+            bind(LineageService.class).to(DataSetLineageService.class).asEagerSingleton();
+            bind(AtlasLineageService.class).to(EntityLineageService.class).asEagerSingleton();
+
+            bindTypeCache();
+
+            //Add EntityAuditListener as EntityChangeListener
+            Multibinder<EntityChangeListener> entityChangeListenerBinder =
+                    Multibinder.newSetBinder(binder(), EntityChangeListener.class);
+            entityChangeListenerBinder.addBinding().to(EntityAuditListener.class);
+
+            final GraphTransactionInterceptor graphTransactionInterceptor = new GraphTransactionInterceptor(new AtlasGraphProvider().get());
+            requestInjection(graphTransactionInterceptor);
+            bindInterceptor(Matchers.any(), Matchers.annotatedWith(GraphTransaction.class), graphTransactionInterceptor);
+        }
+
+        protected void bindTypeCache() {
+            bind(TypeCache.class).to(AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
+        }
+
+        protected void bindDeleteHandler(Binder binder) {
+            binder.bind(DeleteHandler.class).to(AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
+            binder.bind(DeleteHandlerV1.class).to(AtlasRepositoryConfiguration.getDeleteHandlerV1Impl()).asEagerSingleton();
+        }
+
+        protected void bindAuditRepository(Binder binder) {
+
+            Class<? extends EntityAuditRepository> auditRepoImpl = AtlasRepositoryConfiguration.getAuditRepositoryImpl();
+
+            //Map EntityAuditRepository interface to configured implementation
+            binder.bind(EntityAuditRepository.class).to(auditRepoImpl).asEagerSingleton();
+
+            if(Service.class.isAssignableFrom(auditRepoImpl)) {
+                Class<? extends Service> auditRepoService = (Class<? extends Service>)auditRepoImpl;
+                //if it's a service, make sure that it gets properly closed at shutdown
+                Multibinder<Service> serviceBinder = Multibinder.newSetBinder(binder, Service.class);
+                serviceBinder.addBinding().to(auditRepoService);
+            }
+        }
+    }
+
+    public static class SoftDeleteModule extends TestOnlyModule {
+        @Override
+        protected void bindDeleteHandler(Binder binder) {
+            bind(DeleteHandler.class).to(SoftDeleteHandler.class).asEagerSingleton();
+            bind(DeleteHandlerV1.class).to(SoftDeleteHandlerV1.class).asEagerSingleton();
+            bind(AtlasEntityChangeNotifier.class).toProvider(MockNotifier.class);
+        }
+    }
+
+    public static class HardDeleteModule extends TestOnlyModule {
+        @Override
+        protected void bindDeleteHandler(Binder binder) {
+            bind(DeleteHandler.class).to(HardDeleteHandler.class).asEagerSingleton();
+            bind(DeleteHandlerV1.class).to(HardDeleteHandlerV1.class).asEagerSingleton();
+            bind(AtlasEntityChangeNotifier.class).toProvider(MockNotifier.class);
+        }
+    }
+
+    /**
+     * Guice module which sets TypeCache implementation class configuration property to {@link StoreBackedTypeCache}.
+     *
+     */
+    public static class StoreBackedTypeCacheTestModule extends TestOnlyModule {
+        @Override
+        protected void bindTypeCache() {
+            bind(TypeCache.class).to(StoreBackedTypeCache.class).asEagerSingleton();
+        }
+    }
+}
diff --git a/repository/src/test/java/org/apache/atlas/TestUtils.java b/repository/src/test/java/org/apache/atlas/TestUtils.java
index cf39d8d..1e439f7 100755
--- a/repository/src/test/java/org/apache/atlas/TestUtils.java
+++ b/repository/src/test/java/org/apache/atlas/TestUtils.java
@@ -20,10 +20,11 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-import com.google.inject.Provider;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.listener.TypesChangeListener;
 import org.apache.atlas.repository.MetadataRepository;
+import org.apache.atlas.repository.audit.InMemoryEntityAuditRepository;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphBackedMetadataRepository;
 import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
@@ -64,7 +65,6 @@
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -600,20 +600,18 @@
             typeCache = new DefaultTypeCache();
         }
         final GraphBackedSearchIndexer indexer = new GraphBackedSearchIndexer(new AtlasTypeRegistry());
-        Provider<TypesChangeListener> indexerProvider = new Provider<TypesChangeListener>() {
-
-            @Override
-            public TypesChangeListener get() {
-                return indexer;
-            }
-        };
 
         Configuration config = ApplicationProperties.get();
-        ITypeStore typeStore = new GraphBackedTypeStore();
+        ITypeStore typeStore = new GraphBackedTypeStore(AtlasGraphProvider.getGraphInstance());
         DefaultMetadataService defaultMetadataService = new DefaultMetadataService(repo,
                 typeStore,
-                Collections.singletonList(indexerProvider),
-                new ArrayList<Provider<EntityChangeListener>>(), TypeSystem.getInstance(), config, typeCache);
+                new HashSet<TypesChangeListener>() {{ add(indexer); }},
+                new HashSet<EntityChangeListener>(),
+                TypeSystem.getInstance(),
+                config,
+                typeCache,
+                // Fixme: Can we work with Noop
+                new InMemoryEntityAuditRepository());
 
         //commit the created types
         getGraph().commit();
diff --git a/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
index fc38edf..c700a61 100644
--- a/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
@@ -19,10 +19,10 @@
 package org.apache.atlas.discovery;
 
 import com.google.common.collect.ImmutableList;
-import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.BaseRepositoryTest;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.query.QueryParams;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
@@ -55,7 +55,7 @@
 /**
  * Unit tests for Hive LineageService.
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class DataSetLineageServiceTest extends BaseRepositoryTest {
 
     @Inject
@@ -400,7 +400,7 @@
 
         //Delete the entity. Lineage for entity returns the same results as before.
         //Lineage for table name throws EntityNotFoundException
-        AtlasClient.EntityResult deleteResult = repository.deleteEntities(Arrays.asList(tableId));
+        EntityResult deleteResult = repository.deleteEntities(Arrays.asList(tableId));
         assertTrue(deleteResult.getDeletedEntities().contains(tableId));
 
         results = new JSONObject(lineageService.getSchemaForEntity(tableId));
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index 3ea8f34..834abe1 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -22,7 +22,7 @@
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.BaseRepositoryTest;
 import org.apache.atlas.RequestContext;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.query.QueryParams;
@@ -62,7 +62,7 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
 
     @Inject
diff --git a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
index 0a4a445..8a88f32 100644
--- a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
@@ -19,15 +19,15 @@
 package org.apache.atlas.lineage;
 
 import com.google.common.collect.ImmutableList;
-import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.BaseRepositoryTest;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.EntityLineageService;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasEntity.Status;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.model.lineage.AtlasLineageInfo;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
@@ -56,7 +56,7 @@
 /**
  * Unit tests for the new v2 Instance LineageService.
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class EntityLineageServiceTest extends BaseRepositoryTest {
 
     @Inject
@@ -301,7 +301,7 @@
 
         //Delete the table entity. Lineage for entity returns the same results as before.
         //Lineage for table name throws EntityNotFoundException
-        AtlasClient.EntityResult deleteResult = repository.deleteEntities(Arrays.asList(entityGuid));
+        EntityResult deleteResult = repository.deleteEntities(Arrays.asList(entityGuid));
         assertTrue(deleteResult.getDeletedEntities().contains(entityGuid));
 
         inputLineage = getInputLineageInfo(entityGuid, 5);
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
index 59d2a3f..88de2c4 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
@@ -63,12 +63,12 @@
     private final GraphPersistenceStrategies STRATEGY = mock(GraphPersistenceStrategies.class);
 
     @BeforeClass
-    public void setUp() {
+    public void setUp() throws RepositoryException {
         GremlinQueryOptimizer.reset();
         GremlinQueryOptimizer.setExpressionFactory(getFactory());
         when(STRATEGY.typeAttributeName()).thenReturn(Constants.ENTITY_TYPE_PROPERTY_KEY);
         when(STRATEGY.superTypeAttributeName()).thenReturn(Constants.SUPER_TYPES_PROPERTY_KEY);
-        repo = new GraphBackedMetadataRepository(this, new HardDeleteHandler(TypeSystem.getInstance()));
+        repo = new GraphBackedMetadataRepository(new HardDeleteHandler(TypeSystem.getInstance()), this.get());
     }
 
     private FieldInfo getTestFieldInfo() throws AtlasException {
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
index 4fd416c..0e22080 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
@@ -21,12 +21,12 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasClient;
-import org.apache.atlas.AtlasClient.EntityResult;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.RequestContext;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.repository.RepositoryException;
@@ -53,6 +53,7 @@
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -72,7 +73,7 @@
  * Guice loads the dependencies and injects the necessary objects
  *
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public abstract class GraphBackedMetadataRepositoryDeleteTestBase {
 
     protected MetadataRepository repositoryService;
@@ -83,6 +84,9 @@
 
     private ClassType compositeMapValueType;
 
+    @Inject
+    AtlasGraph atlasGraph;
+
     @BeforeClass
     public void setUp() throws Exception {
 
@@ -90,7 +94,7 @@
         typeSystem.reset();
 
         new GraphBackedSearchIndexer(new AtlasTypeRegistry());
-        final GraphBackedMetadataRepository delegate = new GraphBackedMetadataRepository(getDeleteHandler(typeSystem));
+        final GraphBackedMetadataRepository delegate = new GraphBackedMetadataRepository(getDeleteHandler(typeSystem), atlasGraph);
 
         repositoryService = TestUtils.addTransactionWrapper(delegate);
 
@@ -126,7 +130,7 @@
     @AfterClass
     public void tearDown() throws Exception {
         TypeSystem.getInstance().reset();
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @Test
@@ -194,7 +198,7 @@
         table.set(COLUMNS_ATTR_NAME, Arrays.asList(new Id(colId, 0, COLUMN_TYPE)));
         String tableId = createInstance(table);
 
-        AtlasClient.EntityResult entityResult = deleteEntities(colId);
+        EntityResult entityResult = deleteEntities(colId);
         assertEquals(entityResult.getDeletedEntities().size(), 1);
         assertEquals(entityResult.getDeletedEntities().get(0), colId);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
@@ -227,7 +231,7 @@
 
     protected abstract void assertEntityDeleted(String id) throws Exception;
 
-    private AtlasClient.EntityResult deleteEntities(String... id) throws Exception {
+    private EntityResult deleteEntities(String... id) throws Exception {
         RequestContext.createContext();
         return repositoryService.deleteEntities(Arrays.asList(id));
     }
@@ -261,7 +265,7 @@
         String colId = columns.get(0).getId()._getId();
         String tableId = tableInstance.getId()._getId();
 
-        AtlasClient.EntityResult entityResult = deleteEntities(colId);
+        EntityResult entityResult = deleteEntities(colId);
         assertEquals(entityResult.getDeletedEntities().size(), 1);
         assertEquals(entityResult.getDeletedEntities().get(0), colId);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
@@ -389,7 +393,7 @@
         return entityDefinition;
     }
 
-    private AtlasClient.EntityResult updatePartial(ITypedReferenceableInstance entity) throws RepositoryException {
+    private EntityResult updatePartial(ITypedReferenceableInstance entity) throws RepositoryException {
         RequestContext.createContext();
         return repositoryService.updatePartial(entity).getEntityResult();
     }
@@ -419,7 +423,7 @@
         ClassType personType = typeSystem.getDataType(ClassType.class, "Person");
         ITypedReferenceableInstance maxEntity = personType.createInstance(max.getId());
         maxEntity.set("mentor", johnGuid);
-        AtlasClient.EntityResult entityResult = updatePartial(maxEntity);
+        EntityResult entityResult = updatePartial(maxEntity);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
         assertTrue(entityResult.getUpdateEntities().contains(maxGuid));
 
@@ -512,7 +516,7 @@
         Assert.assertTrue(subordinateIds.contains(maxGuid));
 
 
-        AtlasClient.EntityResult entityResult = deleteEntities(maxGuid);
+        EntityResult entityResult = deleteEntities(maxGuid);
         ITypedReferenceableInstance john = repositoryService.getEntityDefinition("Person", "name", "John");
 
         assertEquals(entityResult.getDeletedEntities().size(), 1);
@@ -560,7 +564,7 @@
         String columnGuid = columns.get(0).getId()._getId();
 
         // Delete the column.
-        AtlasClient.EntityResult entityResult = deleteEntities(columnGuid);
+        EntityResult entityResult = deleteEntities(columnGuid);
         assertEquals(entityResult.getDeletedEntities().size(), 1);
         Assert.assertTrue(entityResult.getDeletedEntities().contains(columnGuid));
         assertEquals(entityResult.getUpdateEntities().size(), 1);
@@ -672,7 +676,7 @@
         Assert.assertEquals(refList.get(0).getId()._getId(), traitTargetGuid);
 
         // Delete the entities that are targets of the struct and trait instances.
-        AtlasClient.EntityResult entityResult = deleteEntities(structTargetGuid, traitTargetGuid);
+        EntityResult entityResult = deleteEntities(structTargetGuid, traitTargetGuid);
         Assert.assertEquals(entityResult.getDeletedEntities().size(), 2);
         Assert.assertTrue(entityResult.getDeletedEntities().containsAll(Arrays.asList(structTargetGuid, traitTargetGuid)));
         assertEntityDeleted(structTargetGuid);
@@ -1037,7 +1041,7 @@
         String table2Id = createInstance(table2);
 
         // Delete the tables and column
-        AtlasClient.EntityResult entityResult = deleteEntities(table1Id, colId, table2Id);
+        EntityResult entityResult = deleteEntities(table1Id, colId, table2Id);
         Assert.assertEquals(entityResult.getDeletedEntities().size(), 3);
         Assert.assertTrue(entityResult.getDeletedEntities().containsAll(Arrays.asList(colId, table1Id, table2Id)));
         assertEntityDeleted(table1Id);
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
index 9f44c31..8120aaa 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
@@ -22,10 +22,10 @@
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.GraphTransaction;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.RequestContext;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.query.QueryParams;
 import org.apache.atlas.repository.Constants;
@@ -92,7 +92,7 @@
  * Guice loads the dependencies and injects the necessary objects
  *
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphBackedMetadataRepositoryTest {
 
     @Inject
@@ -126,7 +126,7 @@
     @AfterClass
     public void tearDown() throws Exception {
         TypeSystem.getInstance().reset();
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @Test
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
index a254d0a..ef5d469 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
@@ -20,7 +20,7 @@
 
 import com.google.inject.Inject;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -41,12 +41,10 @@
 import java.util.Arrays;
 import java.util.Set;
 
-import static junit.framework.Assert.assertTrue;
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.*;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphBackedSearchIndexerTest {
     @Inject
     private GraphBackedSearchIndexer graphBackedSearchIndexer;
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
index 4061543..e64c2c8 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
@@ -19,7 +19,7 @@
 package org.apache.atlas.repository.graph;
 
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.graph.GraphHelper.VertexInfo;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -56,7 +56,7 @@
 
 import static org.testng.Assert.*;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphHelperTest {
 
 
@@ -104,7 +104,7 @@
 
     @AfterClass
     public void tearDown() {
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @Test
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
index 21926dc..1f077ba 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
@@ -20,9 +20,9 @@
 
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.GraphTransaction;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
+import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -54,7 +54,7 @@
 import java.util.Iterator;
 
 @Test
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphRepoMapperScaleTest {
 
     private static final String DATABASE_NAME = "foo";
@@ -89,7 +89,7 @@
     @AfterClass
     public void tearDown() throws Exception {
         TypeSystem.getInstance().reset();
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @Test
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
index 9778c63..a3207fb 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
@@ -17,9 +17,10 @@
  */
 package org.apache.atlas.repository.graph;
 
+import org.apache.atlas.TestModules;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.types.TypeSystem;
 import org.testng.Assert;
+import org.testng.annotations.Guice;
 
 import java.util.List;
 
@@ -28,14 +29,8 @@
  * Run tests in {@link ReverseReferenceUpdateTestBase} with hard delete enabled.
  *
  */
+@Guice(modules = TestModules.HardDeleteModule.class)
 public class ReverseReferenceUpdateHardDeleteTest extends ReverseReferenceUpdateTestBase {
-
-    @Override
-    DeleteHandler getDeleteHandler(TypeSystem typeSystem) {
-
-        return new HardDeleteHandler(typeSystem);
-    }
-
     @Override
     void assertTestOneToOneReference(Object refValue, ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance referencingInstance) throws Exception {
         // Verify reference was disconnected
@@ -48,5 +43,4 @@
         List<ITypedReferenceableInstance> refValues = (List<ITypedReferenceableInstance>) object;
         Assert.assertEquals(refValues.size(), 1);
     }
-
 }
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
index 100ccfb..c5eda37 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
@@ -17,13 +17,14 @@
  */
 package org.apache.atlas.repository.graph;
 
+import org.apache.atlas.TestModules;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.TypeSystem;
 import org.testng.Assert;
+import org.testng.annotations.Guice;
 
 import java.util.Iterator;
 import java.util.List;
@@ -33,14 +34,8 @@
  * Run tests in {@link ReverseReferenceUpdateTestBase} with soft delete enabled.
  *
  */
+@Guice(modules = TestModules.SoftDeleteModule.class)
 public class ReverseReferenceUpdateSoftDeleteTest extends ReverseReferenceUpdateTestBase {
-
-    @Override
-    DeleteHandler getDeleteHandler(TypeSystem typeSystem) {
-
-        return new SoftDeleteHandler(typeSystem);
-    }
-
     @Override
     void assertTestOneToOneReference(Object actual, ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance referencingInstance) throws Exception {
         // Verify reference was not disconnected if soft deletes are enabled.
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
index c08fbc9..26dc6a8 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
@@ -21,10 +21,8 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Inject;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.types.AttributeDefinition;
@@ -40,7 +38,6 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import java.util.Arrays;
@@ -52,9 +49,7 @@
  * Verifies automatic update of reverse references
  *
  */
-@Guice(modules = TestOnlyModule.class)
 public abstract class ReverseReferenceUpdateTestBase {
-
     @Inject
     MetadataRepository repositoryService;
 
@@ -63,8 +58,6 @@
     protected ClassType typeA;
     protected ClassType typeB;
 
-    abstract DeleteHandler getDeleteHandler(TypeSystem typeSystem);
-
     abstract void assertTestOneToOneReference(Object actual, ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance referencingInstance) throws Exception;
     abstract void assertTestOneToManyReference(Object refValue, ITypedReferenceableInstance referencingInstance) throws Exception;
 
@@ -73,8 +66,6 @@
         typeSystem = TypeSystem.getInstance();
         typeSystem.reset();
 
-        new GraphBackedSearchIndexer(new AtlasTypeRegistry());
-
         HierarchicalTypeDefinition<ClassType> aDef = TypesUtil.createClassTypeDef("A", ImmutableSet.<String>of(),
             TypesUtil.createRequiredAttrDef("name", DataTypes.STRING_TYPE),
             new AttributeDefinition("b", "B", Multiplicity.OPTIONAL, false, "a"), // 1-1
@@ -95,7 +86,6 @@
         typeA = typeSystem.getDataType(ClassType.class, "A");
         typeB = typeSystem.getDataType(ClassType.class, "B");
 
-        repositoryService = new GraphBackedMetadataRepository(getDeleteHandler(typeSystem));
         repositoryService = TestUtils.addTransactionWrapper(repositoryService);
     }
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
index b34db82..b835d22 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
@@ -18,8 +18,7 @@
 package org.apache.atlas.repository.impexp;
 
 
-import com.google.inject.Inject;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.impexp.AtlasExportRequest;
@@ -33,20 +32,21 @@
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1;
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream;
 import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
+import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
 import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.powermock.reflect.Whitebox;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.powermock.reflect.Whitebox;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 import scala.actors.threadpool.Arrays;
 
+import javax.inject.Inject;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
@@ -61,7 +61,7 @@
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class ExportServiceTest {
     private static final Logger LOG = LoggerFactory.getLogger(ExportServiceTest.class);
 
@@ -71,6 +71,9 @@
     @Inject
     private AtlasTypeDefStore typeDefStore;
 
+    @Inject
+    private EntityGraphMapper graphMapper;
+    @Inject
     ExportService exportService;
     private DeleteHandlerV1 deleteHandler = mock(SoftDeleteHandlerV1.class);;
     private AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class);
@@ -78,7 +81,7 @@
 
     @BeforeClass
     public void setupSampleData() throws AtlasBaseException {
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier);;
+        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier, graphMapper);;
 
         AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes();
         AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry);
@@ -94,11 +97,6 @@
         LOG.debug("==> setupSampleData: ", AtlasEntity.dumpObjects(hrDept.getEntities(), null).toString());
     }
 
-    @BeforeTest
-    public void setupExportService () throws AtlasBaseException {
-        exportService = new ExportService(typeRegistry);
-    }
-
     @AfterClass
     public void clear() {
         AtlasGraphProvider.cleanup();
@@ -257,33 +255,33 @@
     @Test
     public void verifyOverallStatus() throws Exception {
 
-        ExportService service = new ExportService(typeRegistry);
-        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(service,
+//        ExportService service = new ExportService(typeRegistry);
+        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus"));
 
-        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(service,
+        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus",
                 AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(service,
+        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus",
                                 AtlasExportResult.OperationStatus.SUCCESS,
                                 AtlasExportResult.OperationStatus.SUCCESS,
                                 AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(service,
+        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus",
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.PARTIAL_SUCCESS,
                 AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(service,
+        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus",
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.PARTIAL_SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(service,
+        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(exportService,
                 "getOverallOperationStatus",
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.FAIL,
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
index f9a0584..0aaaa70 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.impexp;
 
 import com.google.inject.Inject;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -26,7 +26,7 @@
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Guice;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class ImportServiceReportingTest {
     private static final Logger LOG = LoggerFactory.getLogger(ImportServiceReportingTest.class);
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
index 91966f8..08e9ee8 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.impexp;
 
 import com.google.inject.Inject;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.store.AtlasTypeDefStore;
@@ -36,7 +36,7 @@
 import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.loadModelFromJson;
 import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runAndVerifyQuickStart_v1_Import;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class ImportServiceTest {
     private static final Logger LOG = LoggerFactory.getLogger(ImportServiceTest.class);
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
index 31fba33..5f01136 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
@@ -22,7 +22,7 @@
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
@@ -34,14 +34,10 @@
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
 /**
  * Tests for AtlasEntityStoreV1
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class AtlasEntityDefStoreV1Test {
 
     @Inject
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
index 9b977db..9f7214c 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.store.graph;
 
 import com.google.inject.Inject;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.SearchFilter;
@@ -28,12 +28,10 @@
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
@@ -44,7 +42,7 @@
 
 import static org.testng.Assert.*;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class AtlasTypeDefGraphStoreTest {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStoreTest.class);
 
@@ -52,11 +50,6 @@
     private
     AtlasTypeDefStore typeDefStore;
 
-    @AfterClass
-    public void clear(){
-        AtlasGraphProvider.cleanup();
-    }
-
     @Test(priority = 1)
     public void testGet() {
         try {
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
index 9a11e08..9331e35 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
@@ -21,7 +21,6 @@
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContextV1;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -39,7 +38,6 @@
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graph.AtlasEdgeLabel;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
@@ -63,7 +61,6 @@
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import javax.inject.Inject;
@@ -81,7 +78,6 @@
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-@Guice(modules = TestOnlyModule.class)
 public abstract class AtlasDeleteHandlerV1Test {
 
     @Inject
@@ -90,6 +86,7 @@
     @Inject
     AtlasTypeDefStore typeDefStore;
 
+    @Inject
     AtlasEntityStore entityStore;
 
     @Inject
@@ -101,13 +98,9 @@
 
     private TypeSystem typeSystem = TypeSystem.getInstance();
 
-    AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class);
-
-
     @BeforeClass
     public void setUp() throws Exception {
         metadataService = TestUtils.addSessionCleanupWrapper(metadataService);
-        new GraphBackedSearchIndexer(typeRegistry);
         final AtlasTypesDef deptTypesDef = TestUtilsV2.defineDeptEmployeeTypes();
         typeDefStore.createTypesDef(deptTypesDef);
 
@@ -144,8 +137,6 @@
 
     @BeforeTest
     public void init() throws Exception {
-        DeleteHandlerV1 deleteHandler = getDeleteHandler(typeRegistry);
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier);
         RequestContextV1.clear();
 
     }
@@ -155,8 +146,6 @@
         AtlasGraphProvider.cleanup();
     }
 
-    abstract DeleteHandlerV1 getDeleteHandler(AtlasTypeRegistry typeRegistry);
-
     @Test
     public void testDeleteAndCreate() throws Exception {
         init();
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
index 1dd7276..44067b9 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
@@ -20,8 +20,8 @@
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.RequestContextV1;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -83,7 +83,7 @@
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class AtlasEntityStoreV1Test {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityStoreV1Test.class);
 
@@ -106,6 +106,8 @@
     private AtlasEntityWithExtInfo   tblEntity;
 
     AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class);
+    @Inject
+    private EntityGraphMapper graphMapper;
 
 
     @BeforeClass
@@ -137,7 +139,7 @@
 
     @BeforeTest
     public void init() throws Exception {
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier);
+        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier, graphMapper);
         RequestContextV1.clear();
     }
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1Test.java
index 4403b12..407ebff 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1Test.java
@@ -20,6 +20,7 @@
 
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasEntity;
@@ -28,11 +29,11 @@
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
 import org.testng.Assert;
+import org.testng.annotations.Guice;
 
 import java.util.List;
 import java.util.Map;
@@ -44,13 +45,9 @@
 import static org.testng.Assert.fail;
 import static org.testng.AssertJUnit.assertNotNull;
 
+@Guice(modules = TestModules.HardDeleteModule.class)
 public class HardDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
 
-    @Override
-    DeleteHandlerV1 getDeleteHandler(AtlasTypeRegistry typeRegistry) {
-        return new HardDeleteHandlerV1(typeRegistry);
-    }
-
 
     @Override
     protected void assertTableForTestDeleteReference(String tableId) {
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
index 6a23807..d54adeb 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
@@ -18,10 +18,11 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 import com.google.common.collect.ImmutableList;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.type.AtlasTypeUtil;
+import org.testng.annotations.Guice;
 
 import java.util.Map;
 
@@ -31,15 +32,10 @@
 /**
  * Inverse reference update test with {@link HardDeleteHandlerV1}
  */
+@Guice(modules = TestModules.HardDeleteModule.class)
 public class InverseReferenceUpdateHardDeleteV1Test extends InverseReferenceUpdateV1Test {
 
     @Override
-    protected DeleteHandlerV1 getDeleteHandler(AtlasTypeRegistry typeRegistry) {
-
-        return new HardDeleteHandlerV1(typeRegistry);
-    }
-
-    @Override
     protected void verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany(AtlasEntity jane) throws Exception {
 
         // Max should have been removed from the subordinates list, leaving only John.
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
index ae6731c..884ab54 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
@@ -18,10 +18,11 @@
 package org.apache.atlas.repository.store.graph.v1;
 
 import com.google.common.collect.ImmutableList;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.type.AtlasTypeUtil;
+import org.testng.annotations.Guice;
 
 import java.util.Map;
 
@@ -32,15 +33,10 @@
 /**
  * Inverse reference update test with {@link SoftDeleteHandlerV1}
  */
+@Guice(modules = TestModules.SoftDeleteModule.class)
 public class InverseReferenceUpdateSoftDeleteV1Test extends InverseReferenceUpdateV1Test {
 
     @Override
-    protected DeleteHandlerV1 getDeleteHandler(AtlasTypeRegistry typeRegistry) {
-
-        return new SoftDeleteHandlerV1(typeRegistry);
-    }
-
-    @Override
     protected void verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany(AtlasEntity jane)
         throws Exception {
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
index c90f716..e2a8010 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
@@ -20,7 +20,6 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import org.apache.atlas.RequestContextV1;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.model.instance.AtlasEntity;
@@ -31,7 +30,6 @@
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
 import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.services.MetadataService;
@@ -42,7 +40,6 @@
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import javax.inject.Inject;
@@ -52,7 +49,6 @@
 import java.util.Map;
 
 import static org.apache.atlas.TestUtils.NAME;
-import static org.mockito.Mockito.mock;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
@@ -61,35 +57,26 @@
  * Test automatic inverse reference updating in V1 (V2?) code path.
  *
  */
-@Guice(modules = TestOnlyModule.class)
 public abstract class InverseReferenceUpdateV1Test {
-
     @Inject
     AtlasTypeRegistry typeRegistry;
 
     @Inject
     AtlasTypeDefStore typeDefStore;
 
+    @Inject
     AtlasEntityStore entityStore;
 
     @Inject
     MetadataService metadataService;
 
-    @Inject
-    DeleteHandlerV1 deleteHandler;
-
     private AtlasEntitiesWithExtInfo deptEntity;
 
-    AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class);
-
     protected Map<String, AtlasObjectId> nameIdMap = new HashMap<>();
 
-    protected abstract DeleteHandlerV1 getDeleteHandler(AtlasTypeRegistry typeRegistry);
-
     @BeforeClass
     public void setUp() throws Exception {
         metadataService = TestUtils.addSessionCleanupWrapper(metadataService);
-        new GraphBackedSearchIndexer(typeRegistry);
 
         AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineDeptEmployeeTypes(),
                                                               TestUtilsV2.defineInverseReferenceTestTypes()
@@ -104,8 +91,6 @@
         }
 
         deptEntity = TestUtilsV2.createDeptEg2();
-        DeleteHandlerV1 deleteHandler = getDeleteHandler(typeRegistry);
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier);
         init();
         EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(deptEntity), false);
         for (AtlasEntityHeader entityHeader : response.getCreatedEntities()) {
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1Test.java
index 8935faf..3f1ed03 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1Test.java
@@ -19,6 +19,7 @@
 
 
 import org.apache.atlas.AtlasClient;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
@@ -27,13 +28,13 @@
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.testng.Assert;
+import org.testng.annotations.Guice;
 
 import javax.inject.Inject;
 import java.util.List;
@@ -44,17 +45,13 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
+@Guice(modules = TestModules.SoftDeleteModule.class)
 public class SoftDeleteHandlerV1Test extends AtlasDeleteHandlerV1Test {
 
     @Inject
     MetadataService metadataService;
 
     @Override
-    DeleteHandlerV1 getDeleteHandler(final AtlasTypeRegistry typeRegistry) {
-        return new SoftDeleteHandlerV1(typeRegistry);
-    }
-
-    @Override
     protected void assertDeletedColumn(final AtlasEntity.AtlasEntityWithExtInfo tableInstance) throws AtlasBaseException {
         final List<AtlasObjectId> columns = (List<AtlasObjectId>) tableInstance.getEntity().getAttribute(COLUMNS_ATTR_NAME);
         Assert.assertEquals(columns.size(), 3);
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
index 65cd938..6e3dabb 100755
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
@@ -21,10 +21,9 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.RepositoryException;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
@@ -50,7 +49,7 @@
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createStructTypeDef;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class GraphBackedTypeStoreTest {
     
     private static final String DESCRIPTION = "_description";
@@ -70,7 +69,7 @@
     @AfterClass
     public void tearDown() throws Exception {
         ts.reset();
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
 
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
deleted file mode 100644
index 6c5dcfc..0000000
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.repository.typestore;
-
-import com.google.inject.Inject;
-import org.apache.atlas.typesystem.types.cache.TypeCache;
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-/**
- *  Verify Guice can successfully instantiate and inject StoreBackTypeCache.
- *  StoreBackedTypeCacheTestModule Guice module uses Atlas configuration
- *  which has type cache implementation class set to {@link StoreBackedTypeCache}.
- */
-@Guice(modules = StoreBackedTypeCacheTestOnlyModule.class)
-public class StoreBackedTypeCacheConfigurationTest {
-
-    @Inject
-    private TypeCache typeCache;
-
-    @Test
-    public void testConfigureAsTypeCache() throws Exception {
-        // Verify Guice successfully instantiated and injected StoreBackTypeCache
-        Assert.assertTrue(typeCache instanceof StoreBackedTypeCache);
-    }
-}
\ No newline at end of file
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest.java
index 1608bd7..2ea63ff 100644
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTest.java
@@ -20,9 +20,8 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.typesystem.types.AttributeInfo;
 import org.apache.atlas.typesystem.types.ClassType;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
@@ -46,7 +45,7 @@
 /**
  * Unit test for {@link StoreBackedTypeCache}
  */
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class StoreBackedTypeCacheTest {
 
     @Inject
@@ -87,7 +86,7 @@
     @AfterClass
     public void tearDown() throws Exception {
         ts.reset();
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @BeforeMethod
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTestOnlyModule.java b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTestOnlyModule.java
deleted file mode 100644
index 7fb0155..0000000
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheTestOnlyModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.repository.typestore;
-
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestOnlyModule;
-import org.apache.atlas.util.AtlasRepositoryConfiguration;
-import org.apache.commons.configuration.Configuration;
-
-
-/**
- * Guice module which sets TypeCache implementation class configuration property to {@link StoreBackedTypeCache}.
- *
- */
-public class StoreBackedTypeCacheTestOnlyModule extends TestOnlyModule {
-
-    @Override
-    protected Configuration getConfiguration() {
-        try {
-            Configuration configuration = ApplicationProperties.get();
-            configuration.setProperty(AtlasRepositoryConfiguration.TYPE_CACHE_IMPLEMENTATION_PROPERTY,
-                    StoreBackedTypeCache.class.getName());
-            return configuration;
-        } catch (AtlasException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
index 7e2edd8..d8d8d91 100644
--- a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
@@ -24,14 +24,15 @@
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.RequestContext;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.ChangedTypeDefs;
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.listener.TypeDefChangeListener;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.query.QueryParams;
 import org.apache.atlas.repository.audit.EntityAuditRepository;
 import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
@@ -85,7 +86,7 @@
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
 import static org.testng.Assert.*;
 
-@Guice(modules = TestOnlyModule.class)
+@Guice(modules = TestModules.TestOnlyModule.class)
 public class DefaultMetadataServiceTest {
     @Inject
     private MetadataService metadataService;
@@ -150,7 +151,7 @@
             AtlasGraphProvider.cleanup();
         }
     }
-    private AtlasClient.EntityResult updateInstance(Referenceable entity) throws Exception {
+    private EntityResult updateInstance(Referenceable entity) throws Exception {
         RequestContext.createContext();
         ParamChecker.notNull(entity, "Entity");
         ParamChecker.notNull(entity.getId(), "Entity");
@@ -296,7 +297,7 @@
         assertAuditEvents(id, EntityAuditEvent.EntityAuditAction.ENTITY_DELETE);
     }
 
-    private AtlasClient.EntityResult deleteEntities(String... guids) throws AtlasException {
+    private EntityResult deleteEntities(String... guids) throws AtlasException {
         RequestContext.createContext();
         return metadataService.deleteEntities(Arrays.asList(guids));
     }
@@ -529,7 +530,7 @@
         assertEquals(actualColumns, updatedColNameList);
     }
 
-    private AtlasClient.EntityResult updateEntityPartial(String guid, Referenceable entity) throws AtlasException {
+    private EntityResult updateEntityPartial(String guid, Referenceable entity) throws AtlasException {
         RequestContext.createContext();
         return metadataService.updateEntityPartialByGuid(guid, entity).getEntityResult();
     }
@@ -547,7 +548,7 @@
             put(COLUMNS_ATTR_NAME, columns);
         }});
 
-        AtlasClient.EntityResult entityResult = updateEntityPartial(tableId._getId(), tableUpdated);
+        EntityResult entityResult = updateEntityPartial(tableId._getId(), tableUpdated);
         assertEquals(entityResult.getCreatedEntities().size(), 1);  //col1 created
         assertEquals(entityResult.getUpdateEntities().size(), 1);  //table updated
         assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
@@ -1020,7 +1021,7 @@
 
         //Delete one column
         String columnId = table1Columns.get(0).getId()._getId();
-        AtlasClient.EntityResult entityResult = deleteEntities(columnId);
+        EntityResult entityResult = deleteEntities(columnId);
         //column is deleted and table is updated
         assertEquals(entityResult.getDeletedEntities().get(0), columnId);
         assertEquals(entityResult.getUpdateEntities().get(0), table1Entity.getId()._getId());
diff --git a/repository/src/test/java/org/apache/atlas/service/StoreBackedTypeCacheMetadataServiceTest.java b/repository/src/test/java/org/apache/atlas/service/StoreBackedTypeCacheMetadataServiceTest.java
index 217fc8d..5c37b9e 100644
--- a/repository/src/test/java/org/apache/atlas/service/StoreBackedTypeCacheMetadataServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/service/StoreBackedTypeCacheMetadataServiceTest.java
@@ -19,12 +19,11 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-import com.google.inject.Inject;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.typestore.ITypeStore;
 import org.apache.atlas.repository.typestore.StoreBackedTypeCache;
-import org.apache.atlas.repository.typestore.StoreBackedTypeCacheTestOnlyModule;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.json.TypesSerialization;
@@ -44,14 +43,17 @@
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
+import javax.inject.Inject;
+
 
 /**
  *  Verify MetadataService type operations trigger StoreBackedTypeCache to load non-cached types from the store.
  *  StoreBackedTypeCacheTestModule Guice module sets Atlas configuration
  *  to use {@link StoreBackedTypeCache} as the TypeCache implementation class.
  */
-@Guice(modules = StoreBackedTypeCacheTestOnlyModule.class)
-public class StoreBackedTypeCacheMetadataServiceTest {
+@Guice(modules = TestModules.StoreBackedTypeCacheTestModule.class)
+public class StoreBackedTypeCacheMetadataServiceTest
+{
     @Inject
     private MetadataService metadataService;
 
diff --git a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
index d503ef7..d490083 100644
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
@@ -17,7 +17,7 @@
  */
 package org.apache.atlas.services;
 
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules.TestOnlyModule;
 import org.apache.atlas.discovery.EntityDiscoveryService;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
@@ -28,7 +28,6 @@
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.testng.Assert.assertEquals;
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
index 60464be..a948d16 100755
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
@@ -41,7 +41,7 @@
   @BeforeClass
   def beforeAll() {
      TypeSystem.getInstance().reset()
-     var repo = new GraphBackedMetadataRepository(null)
+     var repo = new GraphBackedMetadataRepository(null, new AtlasGraphProvider().get())
      TestUtils.setupGraphProvider(repo)
     //force graph to be initialized first
     AtlasGraphProvider.getGraphInstance()
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
index cc22865..880a0c6 100755
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
@@ -43,7 +43,7 @@
   def beforeAll() {
     TypeSystem.getInstance().reset()
     QueryTestsUtils.setupTypes
-    var repo = new GraphBackedMetadataRepository(null);
+    var repo = new GraphBackedMetadataRepository(null, null);
     gp = new DefaultGraphPersistenceStrategy(repo)
     g = QueryTestsUtils.setupTestGraph(repo)
   }
diff --git a/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala b/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
index 3a3c967..b01cbf8 100755
--- a/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
@@ -43,7 +43,7 @@
     @BeforeClass
     def beforeAll() {
         TypeSystem.getInstance().reset()
-        var repo = new GraphBackedMetadataRepository(null);
+        var repo = new GraphBackedMetadataRepository(null, new AtlasGraphProvider().get());
         TestUtils.setupGraphProvider(repo);
         //force graph to be initialized first
         AtlasGraphProvider.getGraphInstance();
diff --git a/server-api/pom.xml b/server-api/pom.xml
index 278184f..7761a71 100644
--- a/server-api/pom.xml
+++ b/server-api/pom.xml
@@ -37,11 +37,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-typesystem</artifactId>
         </dependency>
@@ -60,58 +55,5 @@
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-client</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>org.aspectj</groupId>
-            <artifactId>aspectjrt</artifactId>
-        </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>aspectj-maven-plugin</artifactId>
-                <configuration>
-                    <complianceLevel>1.7</complianceLevel>
-                    <showWeaveInfo>true</showWeaveInfo>
-                    <verbose>true</verbose>
-                    <forceAjcCompile>true</forceAjcCompile>
-                    <includes>
-                        <include>**/*.java</include>
-                        <include>**/*.aj</include>
-                    </includes>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>compile_with_aspectj</id>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                        <configuration>
-                            <aspectDirectory>src/main/java</aspectDirectory>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>test-compile_with_aspectj</id>
-                        <goals>
-                            <goal>test-compile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjrt</artifactId>
-                        <version>${aspectj.runtime.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjtools</artifactId>
-                        <version>${aspectj.runtime.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-        </plugins>
-    </build>
 </project>
diff --git a/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java b/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java
deleted file mode 100644
index 3579dd2..0000000
--- a/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.aspect;
-
-import org.apache.atlas.RequestContext;
-import org.apache.atlas.metrics.Metrics;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.Signature;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Arrays;
-import java.util.List;
-
-@Aspect
-public class AtlasAspect {
-
-    public static final Logger LOG = LoggerFactory.getLogger(AtlasAspect.class);
-
-    @Around("@annotation(org.apache.atlas.aspect.Monitored) && execution(* *(..))")
-    public Object collectMetricsForMonitored(ProceedingJoinPoint joinPoint) throws Throwable {
-        Signature methodSign = joinPoint.getSignature();
-        Metrics metrics = RequestContext.getMetrics();
-        String metricName = methodSign.getDeclaringType().getSimpleName() + "." + methodSign.getName();
-        long start = System.currentTimeMillis();
-
-        try {
-            Object response = joinPoint.proceed();
-            return response;
-        } finally {
-            metrics.record(metricName, (System.currentTimeMillis() - start));
-        }
-    }
-
-    @Around("@annotation(org.apache.atlas.aspect.Loggable) && execution(* *(..))")
-    public Object logAroundLoggable(ProceedingJoinPoint joinPoint) throws Throwable {
-        Signature methodSign = joinPoint.getSignature();
-        String methodName = methodSign.getDeclaringType().getSimpleName() + "." + methodSign.getName();
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug(String.format("==> %s(%s)", methodName, Arrays.toString(joinPoint.getArgs())));
-        }
-        Object response = joinPoint.proceed();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug(String.format("<== %s(%s): %s", methodName, Arrays.toString(joinPoint.getArgs()),
-                    response instanceof List ? ((List)response).size() : response));
-        }
-        return response;
-    }
-}
\ No newline at end of file
diff --git a/server-api/src/main/java/org/apache/atlas/services/MetadataService.java b/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
index 31ef7b5..7fb3d3f 100644
--- a/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
+++ b/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
@@ -18,11 +18,11 @@
 
 package org.apache.atlas.services;
 
-import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.EntityAuditEvent;
 import org.apache.atlas.listener.EntityChangeListener;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
@@ -267,7 +267,7 @@
      * @return List of guids for deleted entities
      * @throws AtlasException
      */
-    AtlasClient.EntityResult deleteEntities(List<String> guids) throws AtlasException;
+    EntityResult deleteEntities(List<String> guids) throws AtlasException;
     
     /**
      * Register a listener for entity change.
@@ -292,8 +292,8 @@
      * @return List of guids for deleted entities (including their composite references)
      * @throws AtlasException
      */
-    AtlasClient.EntityResult deleteEntityByUniqueAttribute(String typeName, String uniqueAttributeName,
-                                                           String attrValue) throws AtlasException;
+    EntityResult deleteEntityByUniqueAttribute(String typeName, String uniqueAttributeName,
+                                               String attrValue) throws AtlasException;
 
     /**
      * Returns entity audit events for entity id in the decreasing order of timestamp
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
index c853ec6..262f784 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
@@ -20,7 +20,6 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.classification.InterfaceAudience;
 import org.apache.atlas.typesystem.TypesDef;
@@ -31,6 +30,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.inject.Singleton;
 import java.lang.reflect.Constructor;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -41,8 +41,6 @@
 import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.inject.Singleton;
-
 @Singleton
 @InterfaceAudience.Private
 @Deprecated
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystemProvider.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystemProvider.java
deleted file mode 100644
index 4e1cd36..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystemProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.inject.Provider;
-
-public class TypeSystemProvider implements Provider<TypeSystem> {
-    @Override
-    public TypeSystem get() {
-        return TypeSystem.getInstance();
-    }
-}
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java
index ce750af..0d86474 100644
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCache.java
@@ -17,8 +17,8 @@
  */
 package org.apache.atlas.typesystem.types.cache;
 
-import com.google.inject.Singleton;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
 import org.apache.atlas.typesystem.types.ClassType;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
 import org.apache.atlas.typesystem.types.EnumType;
@@ -29,7 +29,9 @@
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Singleton;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -41,8 +43,10 @@
 /**
  * Caches the types in-memory within the same process space.
  */
-@Singleton
 @SuppressWarnings("rawtypes")
+@Singleton
+@Component
+@ConditionalOnAtlasProperty(property = "atlas.TypeCache.impl", isDefault = true)
 public class DefaultTypeCache implements TypeCache {
     private static final Logger LOG = LoggerFactory.getLogger(DefaultTypeCache.class);
 
diff --git a/typesystem/src/main/resources/atlas-log4j.xml b/typesystem/src/main/resources/atlas-log4j.xml
index 8312657..c30403e 100755
--- a/typesystem/src/main/resources/atlas-log4j.xml
+++ b/typesystem/src/main/resources/atlas-log4j.xml
@@ -75,6 +75,21 @@
         <appender-ref ref="console"/>
     </logger>
 
+    <logger name="org.springframework" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
+    <logger name="org.eclipse" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
+    <logger name="com.sun.jersey" additivity="false">
+        <level value="warn"/>
+        <appender-ref ref="console"/>
+    </logger>
+
     <logger name="AUDIT" additivity="false">
         <level value="info"/>
         <appender-ref ref="console"/>
diff --git a/webapp/pom.xml b/webapp/pom.xml
index 045ccdb..4132912 100755
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -172,11 +172,6 @@
             <artifactId>atlas-catalog</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-graphdb-impls</artifactId>
-            <type>pom</type>
-        </dependency>
         <!-- Zookeeper, curator -->
         <dependency>
             <groupId>org.apache.curator</groupId>
@@ -276,8 +271,24 @@
         </dependency>
 
         <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <version>${guice.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>com.google.inject.extensions</groupId>
-            <artifactId>guice-servlet</artifactId>
+            <artifactId>guice-throwingproviders</artifactId>
+            <version>${guice.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-multibindings</artifactId>
+            <version>${guice.version}</version>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
@@ -286,11 +297,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-guice</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-jsp</artifactId>
         </dependency>
@@ -311,55 +317,94 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-core</artifactId>
         </dependency>
 
         <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-web</artifactId>
+        </dependency>
+
+        <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-webmvc</artifactId>
+        </dependency>
+
+        <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-core</artifactId>
+        </dependency>
+
+        <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-web</artifactId>
+        </dependency>
+
+        <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-config</artifactId>
+        </dependency>
+
+        <dependency>
+                <groupId>org.springframework.security</groupId>
+                <artifactId>spring-security-ldap</artifactId>
+        </dependency>
+        <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <dependency>
+                <groupId>org.springframework.ldap</groupId>
+                <artifactId>spring-ldap-core</artifactId>
+        </dependency>
+
+        <!-- Jersey + Spring -->
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-spring</artifactId>
+            <version>1.8</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-web</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-beans</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-context</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-servlet</artifactId>
+        </dependency>
+        <!-- Required for Spring configuration processing -->
+        <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-core</artifactId>
-            <version>${spring.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-            <version>${spring.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-webmvc</artifactId>
-            <version>${spring.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-core</artifactId>
-            <version>${spring.security.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-web</artifactId>
-            <version>${spring.security.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-config</artifactId>
-            <version>${spring.security.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-ldap</artifactId>
-            <version>${spring.security.version}</version>
+            <artifactId>spring-aop</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework.ldap</groupId>
-            <artifactId>spring-ldap-core</artifactId>
-            <version>${spring-ldap-core.version}</version>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+            <version>1.8.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+            <version>1.8.9</version>
         </dependency>
         <dependency>
             <groupId>org.apache.atlas</groupId>
@@ -367,11 +412,6 @@
             <type>war</type>
         </dependency>
         <dependency>
-                <groupId>javax.servlet</groupId>
-                <artifactId>javax.servlet-api</artifactId>
-                <version>${javax.servlet.version}</version>
-        </dependency>
-        <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
             <version>3.4</version>
@@ -390,7 +430,8 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
-        <dependency>
+
+	    <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-repository</artifactId>
             <classifier>tests</classifier>
@@ -414,10 +455,11 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
         <dependency>
-            <groupId>org.aspectj</groupId>
-            <artifactId>aspectjrt</artifactId>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-repository</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
@@ -644,46 +686,6 @@
             </plugin>
 
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>aspectj-maven-plugin</artifactId>
-                <configuration>
-                    <complianceLevel>1.7</complianceLevel>
-                    <includes>
-                        <include>**/*.java</include>
-                        <include>**/*.aj</include>
-                    </includes>
-                    <XaddSerialVersionUID>true</XaddSerialVersionUID>
-                    <showWeaveInfo>true</showWeaveInfo>
-                    <aspectLibraries>
-                        <aspectLibrary>
-                            <groupId>org.apache.atlas</groupId>
-                            <artifactId>atlas-server-api</artifactId>
-                        </aspectLibrary>
-                    </aspectLibraries>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>compile_with_aspectj</id>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.aspectj</groupId>
-                        <artifactId>aspectjtools</artifactId>
-                        <version>${aspectj.runtime.version}</version>
-                    </dependency>
-
-                    <dependency>
-                        <groupId>org.apache.atlas</groupId>
-                        <artifactId>atlas-server-api</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            <plugin>
                 <groupId>com.webcohesion.enunciate</groupId>
                 <artifactId>enunciate-maven-plugin</artifactId>
                 <configuration>
diff --git a/webapp/src/main/java/org/apache/atlas/Atlas.java b/webapp/src/main/java/org/apache/atlas/Atlas.java
index 14c43cc..e29254b 100755
--- a/webapp/src/main/java/org/apache/atlas/Atlas.java
+++ b/webapp/src/main/java/org/apache/atlas/Atlas.java
@@ -19,9 +19,7 @@
 package org.apache.atlas;
 
 import org.apache.atlas.security.SecurityProperties;
-import org.apache.atlas.setup.SetupException;
 import org.apache.atlas.web.service.EmbeddedServer;
-import org.apache.atlas.web.setup.AtlasSetup;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.GnuParser;
 import org.apache.commons.cli.Option;
@@ -33,6 +31,7 @@
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.bridge.SLF4JBridgeHandler;
 
 import java.util.Iterator;
 
@@ -48,7 +47,7 @@
     private static final String ATLAS_LOG_DIR = "atlas.log.dir";
     public static final String ATLAS_SERVER_HTTPS_PORT = "atlas.server.https.port";
     public static final String ATLAS_SERVER_HTTP_PORT = "atlas.server.http.port";
-    public static final String ATLAS_SERVER_RUN_SETUP_KEY = "atlas.server.run.setup.on.start";
+
 
     private static EmbeddedServer server;
 
@@ -111,28 +110,12 @@
         final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
         configuration.setProperty(SecurityProperties.TLS_ENABLED, String.valueOf(enableTLS));
 
-        runSetupIfRequired(configuration);
         showStartupInfo(buildConfiguration, enableTLS, appPort);
 
         server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
-        server.start();
-    }
+        installLogBridge();
 
-    private static void runSetupIfRequired(Configuration configuration) throws SetupException {
-        boolean shouldRunSetup = configuration.getBoolean(ATLAS_SERVER_RUN_SETUP_KEY, false);
-        if (shouldRunSetup) {
-            LOG.warn("Running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
-            AtlasSetup atlasSetup = new AtlasSetup();
-            try {
-                atlasSetup.run();
-            } catch (SetupException se) {
-                LOG.error("Failed running setup. Will not start the server.");
-                throw se;
-            }
-            LOG.warn("Finished running setup.");
-        } else {
-            LOG.info("Not running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
-        }
+        server.start();
     }
 
     private static void setApplicationHome() {
@@ -204,4 +187,14 @@
         LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
         LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
     }
+
+    private static void installLogBridge() {
+        // Optionally remove existing handlers attached to j.u.l root logger
+        SLF4JBridgeHandler.removeHandlersForRootLogger();  // (since SLF4J 1.6.5)
+
+        // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
+        // the initialization phase of your application
+        SLF4JBridgeHandler.install();
+    }
+
 }
diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
index f3af37d..6eadc96 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
@@ -18,7 +18,6 @@
 package org.apache.atlas.notification;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Inject;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.listener.EntityChangeListener;
@@ -35,7 +34,9 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.configuration.Configuration;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -48,6 +49,7 @@
 /**
  * Listen to the repository for entity changes and produce entity change notifications.
  */
+@Component
 public class NotificationEntityChangeListener implements EntityChangeListener {
 
     private final NotificationInterface notificationInterface;
diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
index e6d5697..2f8245d 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
@@ -19,7 +19,6 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.inject.Singleton;
 import kafka.consumer.ConsumerTimeoutException;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
@@ -45,6 +44,8 @@
 import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.util.ArrayList;
@@ -68,7 +69,8 @@
 /**
  * Consumer of notifications from hooks e.g., hive hook etc.
  */
-@Singleton
+@Component
+@Order(4)
 public class NotificationHookConsumer implements Service, ActiveStateChangeHandler {
     private static final Logger LOG = LoggerFactory.getLogger(NotificationHookConsumer.class);
     private static final String LOCALHOST = "localhost";
diff --git a/webapp/src/main/java/org/apache/atlas/web/errors/AllExceptionMapper.java b/webapp/src/main/java/org/apache/atlas/web/errors/AllExceptionMapper.java
index 9042e88..98bd381 100644
--- a/webapp/src/main/java/org/apache/atlas/web/errors/AllExceptionMapper.java
+++ b/webapp/src/main/java/org/apache/atlas/web/errors/AllExceptionMapper.java
@@ -20,20 +20,19 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import java.util.concurrent.ThreadLocalRandom;
-
-import javax.inject.Singleton;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * Exception mapper for Jersey.
  * @param <E>
  */
 @Provider
-@Singleton
+@Component
 public class AllExceptionMapper implements ExceptionMapper<Exception> {
     private static final Logger LOGGER = LoggerFactory.getLogger(AllExceptionMapper.class);
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java b/webapp/src/main/java/org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java
index ec1767c..f4b8d67 100755
--- a/webapp/src/main/java/org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java
+++ b/webapp/src/main/java/org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java
@@ -21,8 +21,8 @@
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.type.AtlasType;
+import org.springframework.stereotype.Component;
 
-import javax.inject.Singleton;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
@@ -34,7 +34,7 @@
  * AtlasBaseException mapper for Jersey.
  */
 @Provider
-@Singleton
+@Component
 public class AtlasBaseExceptionMapper implements ExceptionMapper<AtlasBaseException> {
 
     @Override
diff --git a/webapp/src/main/java/org/apache/atlas/web/errors/NotFoundExceptionMapper.java b/webapp/src/main/java/org/apache/atlas/web/errors/NotFoundExceptionMapper.java
index 9f97bb2..a33d8d7 100644
--- a/webapp/src/main/java/org/apache/atlas/web/errors/NotFoundExceptionMapper.java
+++ b/webapp/src/main/java/org/apache/atlas/web/errors/NotFoundExceptionMapper.java
@@ -18,15 +18,15 @@
 package org.apache.atlas.web.errors;
 
 import org.apache.atlas.typesystem.exception.NotFoundException;
+import org.springframework.stereotype.Component;
 
-import javax.inject.Singleton;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 import java.util.concurrent.ThreadLocalRandom;
 
 @Provider
-@Singleton
+@Component
 public class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> {
     @Override
     public Response toResponse(NotFoundException e) {
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
index ecc67a7..36f2688 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
@@ -23,9 +23,9 @@
 import org.apache.hadoop.http.HtmlQuoting;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
-import javax.inject.Singleton;
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -46,7 +46,7 @@
  * an error SERVICE_UNAVAILABLE. Identification of this state is carried out using
  * {@link ServiceState} and {@link ActiveInstanceState}.
  */
-@Singleton
+@Component
 public class ActiveServerFilter implements Filter {
 
     private static final Logger LOG = LoggerFactory.getLogger(ActiveServerFilter.class);
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationEntryPoint.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationEntryPoint.java
index 382b494..7767602 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationEntryPoint.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationEntryPoint.java
@@ -16,23 +16,32 @@
  */
 package org.apache.atlas.web.filters;
 
-import java.io.IOException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
+import java.io.IOException;
 
 @SuppressWarnings("deprecation")
-class AtlasAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
+@Component
+public class AtlasAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
 
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAuthenticationEntryPoint.class);
 
     private String loginPath = "/login.jsp";
 
+    @Inject
+    public AtlasAuthenticationEntryPoint(@Value("/login.jsp") String loginFormUrl) {
+        super(loginFormUrl);
+    }
+
     @Override
     public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
             throws IOException, ServletException {
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
index 473c78d..25aede3 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
@@ -51,6 +51,7 @@
 import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -78,6 +79,7 @@
  * todo: Subclass of {@link org.apache.hadoop.security.authentication.server.AuthenticationFilter}.
  */
 
+@Component
 public class AtlasAuthenticationFilter extends AuthenticationFilter {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAuthenticationFilter.class);
     static final String PREFIX = "atlas.authentication.method";
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
index a1a168a..862e34f 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
@@ -31,6 +31,7 @@
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
 import org.springframework.web.filter.GenericFilterBean;
 
 import javax.servlet.FilterChain;
@@ -44,6 +45,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+@Component
 public class AtlasAuthorizationFilter extends GenericFilterBean {
 
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAuthorizationFilter.class);
@@ -95,7 +97,7 @@
         responseWrapper.setHeader("X-Frame-Options", "DENY");
 
         String pathInfo = request.getServletPath();
-        if (!Strings.isNullOrEmpty(pathInfo) && pathInfo.startsWith(BASE_URL)) {
+        if (!Strings.isNullOrEmpty(pathInfo) && (pathInfo.startsWith(BASE_URL) || BASE_URL.startsWith(pathInfo))) {
             if (isDebugEnabled) {
                 LOG.debug("{} is a valid REST API request!!!", pathInfo);
             }
@@ -113,10 +115,11 @@
                 }
             } else {
                 if (LOG.isErrorEnabled()) {
-                    LOG.error("Cannot obtain Security Context : {}", auth);
+                    LOG.error("Cannot obtain Security Context");
                 }
-                throw new ServletException("Cannot obtain Security Context : " + auth);
+                throw new ServletException("Cannot obtain Security Context");
             }
+
             AtlasAccessRequest atlasRequest = new AtlasAccessRequest(request, userName, groups);
             if (isDebugEnabled) {
                 LOG.debug("============================\nUserName :: {}\nGroups :: {}\nURL :: {}\nAction :: {}\nrequest.getServletPath() :: {}\n============================\n", atlasRequest.getUser(), atlasRequest.getUserGroups(), request.getRequestURL(), atlasRequest.getAction(), pathInfo);
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
index 5294c9b..277ac22 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
@@ -18,12 +18,13 @@
 
 package org.apache.atlas.web.filters;
 
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.commons.configuration.Configuration;
+import org.json.simple.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -33,15 +34,14 @@
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasException;
-import org.apache.commons.configuration.Configuration;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.simple.JSONObject;
-
+@Component
 public class AtlasCSRFPreventionFilter implements Filter {
 	private static final Logger LOG = LoggerFactory.getLogger(AtlasCSRFPreventionFilter.class);
 	private static Configuration configuration;
@@ -238,13 +238,11 @@
 		@Override
 		public void sendError(int code, String message) throws IOException {
 			JSONObject json = new JSONObject();
-            ObjectMapper mapper = new ObjectMapper();
             json.put("msgDesc", message);
-            String jsonAsStr = mapper.writeValueAsString(json);
             httpResponse.setContentType("application/json");
             httpResponse.setStatus(code);
             httpResponse.setCharacterEncoding("UTF-8");
-            httpResponse.getWriter().write(jsonAsStr);
+            httpResponse.getWriter().write(json.toJSONString());
 		}
 	}
 }
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java
index d5fa003..665fa34 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java
@@ -20,7 +20,6 @@
 
 package org.apache.atlas.web.filters;
 
-import com.google.inject.Inject;
 import com.nimbusds.jose.JOSEException;
 import com.nimbusds.jose.JWSObject;
 import com.nimbusds.jose.JWSVerifier;
@@ -42,6 +41,9 @@
 import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
 import javax.servlet.*;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -61,6 +63,7 @@
 import org.apache.commons.lang.StringUtils;
 
 
+@Component("ssoAuthenticationFilter")
 public class AtlasKnoxSSOAuthenticationFilter implements Filter {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasKnoxSSOAuthenticationFilter.class);
 
@@ -73,6 +76,8 @@
     public static final String JWT_ORIGINAL_URL_QUERY_PARAM_DEFAULT = "originalUrl";
     public static final String DEFAULT_BROWSER_USERAGENT = "Mozilla,Opera,Chrome";
 
+    private final AtlasAuthenticationProvider authenticationProvider;
+
     private SSOAuthenticationProperties jwtProperties;
 
     private String originalUrlQueryParam = "originalUrl";
@@ -84,7 +89,8 @@
     private JWSVerifier verifier = null;
 
     @Inject
-    public AtlasKnoxSSOAuthenticationFilter() {
+    public AtlasKnoxSSOAuthenticationFilter(AtlasAuthenticationProvider authenticationProvider) {
+        this.authenticationProvider = authenticationProvider;
         try {
             configuration = ApplicationProperties.get();
         } catch (Exception e) {
@@ -97,8 +103,9 @@
         setJwtProperties();
     }
 
-    public AtlasKnoxSSOAuthenticationFilter(
-            SSOAuthenticationProperties jwtProperties) {
+    public AtlasKnoxSSOAuthenticationFilter(AtlasAuthenticationProvider authenticationProvider,
+                                            SSOAuthenticationProperties jwtProperties) {
+        this.authenticationProvider = authenticationProvider;
         this.jwtProperties = jwtProperties;
         setJwtProperties();
     }
@@ -166,7 +173,6 @@
                         final Authentication finalAuthentication = new UsernamePasswordAuthenticationToken(principal, "", grantedAuths);
                         WebAuthenticationDetails webDetails = new WebAuthenticationDetails(httpRequest);
                         ((AbstractAuthenticationToken) finalAuthentication).setDetails(webDetails);
-                        AtlasAuthenticationProvider authenticationProvider = new AtlasAuthenticationProvider();
                         authenticationProvider.setSsoEnabled(ssoEnabled);
                         Authentication authentication = authenticationProvider.authenticate(finalAuthentication);
                         SecurityContextHolder.getContext().setAuthentication(authentication);
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
index 525bbc0..191388a 100755
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
@@ -18,19 +18,18 @@
 
 package org.apache.atlas.web.filters;
 
-import com.google.inject.Singleton;
-
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.RequestContextV1;
 import org.apache.atlas.metrics.Metrics;
-import org.apache.commons.configuration.Configuration;
 import org.apache.atlas.util.AtlasRepositoryConfiguration;
 import org.apache.atlas.web.util.DateTimeHelper;
 import org.apache.atlas.web.util.Servlets;
+import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -40,7 +39,6 @@
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import java.io.IOException;
 import java.util.Date;
 import java.util.UUID;
@@ -49,7 +47,7 @@
  * This records audit information as part of the filter after processing the request
  * and also introduces a UUID into request and response for tracing requests in logs.
  */
-@Singleton
+@Component
 public class AuditFilter implements Filter {
     private static final Logger AUDIT_LOG = LoggerFactory.getLogger("AUDIT");
     private static final Logger LOG = LoggerFactory.getLogger(AuditFilter.class);
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/StaleTransactionCleanupFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/StaleTransactionCleanupFilter.java
index 5f62bc4..cdb9064 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/StaleTransactionCleanupFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/StaleTransactionCleanupFilter.java
@@ -18,7 +18,10 @@
 
 package org.apache.atlas.web.filters;
 
-import java.io.IOException;
+import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -26,12 +29,7 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Singleton;
+import java.io.IOException;
 
 /**
  * Filter that rolls back the stale transaction associated with
@@ -39,7 +37,7 @@
  * see all of the committed changes.
  *
  */
-@Singleton
+@Component
 public class StaleTransactionCleanupFilter implements Filter {
 
     private static final Logger LOG = LoggerFactory.getLogger(StaleTransactionCleanupFilter.class);
@@ -52,6 +50,7 @@
     @Override
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
     throws IOException, ServletException {
+        LOG.info("Cleaning stale transactions");
         AtlasGraphProvider.getGraphInstance().rollback();
         filterChain.doFilter(request, response);
     }
diff --git a/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java b/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
deleted file mode 100755
index 95647e0..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/listeners/GuiceServletConfig.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.listeners;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContextEvent;
-
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasClient;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
-import org.apache.atlas.ha.HAConfiguration;
-import org.apache.atlas.notification.NotificationModule;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.service.Services;
-import org.apache.atlas.web.filters.ActiveServerFilter;
-import org.apache.atlas.web.filters.AuditFilter;
-import org.apache.atlas.web.filters.StaleTransactionCleanupFilter;
-import org.apache.atlas.web.service.ActiveInstanceElectorModule;
-import org.apache.atlas.web.service.ServiceModule;
-import org.apache.commons.configuration.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.bridge.SLF4JBridgeHandler;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.Stage;
-import com.google.inject.servlet.GuiceServletContextListener;
-import com.sun.jersey.api.core.PackagesResourceConfig;
-import com.sun.jersey.guice.JerseyServletModule;
-import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
-
-public class GuiceServletConfig extends GuiceServletContextListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(GuiceServletConfig.class);
-
-    private static final String GUICE_CTX_PARAM = "guice.packages";
-    protected volatile Injector injector;
-
-    @Override
-    protected Injector getInjector() {
-        LOG.info("Loading Guice modules");
-        /*
-         * More information on this can be found here:
-		 * https://jersey.java.net/nonav/apidocs/1
-		 * .11/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary
-		 * .html
-		 */
-        if (injector == null) {
-
-            // perform login operations
-            LoginProcessor loginProcessor = new LoginProcessor();
-            loginProcessor.login();
-
-            injector = Guice.createInjector(Stage.PRODUCTION,  getRepositoryModule(), new ActiveInstanceElectorModule(),
-                    new NotificationModule(), new ServiceModule(), new JerseyServletModule() {
-
-                        private Configuration appConfiguration = null;
-
-                        private Configuration getConfiguration() {
-                            if (appConfiguration == null) {
-                                try {
-                                    appConfiguration = ApplicationProperties.get();
-                                } catch (AtlasException e) {
-                                    LOG.warn("Could not load application configuration", e);
-                                }
-                            }
-                            return appConfiguration;
-                        }
-
-                        @Override
-                        protected void configureServlets() {
-                            filter("/*").through(StaleTransactionCleanupFilter.class);
-                            filter("/*").through(AuditFilter.class);
-                            configureActiveServerFilterIfNecessary();
-
-                            Map<String, String> initParams     = new HashMap<>();
-                            Enumeration<String> initParamNames = getServletContext().getInitParameterNames();
-
-                            while (initParamNames.hasMoreElements()) {
-                                String initParamName  = initParamNames.nextElement();
-                                String initParamValue = getServletContext().getInitParameter(initParamName);
-
-                                if (GUICE_CTX_PARAM.equals(initParamName)) {
-                                    LOG.info("Jersey loading from packages: {}", initParamValue);
-
-                                    initParams.put(PackagesResourceConfig.PROPERTY_PACKAGES, initParamValue);
-                                } else {
-                                    initParams.put(initParamName, initParamValue);
-                                }
-                            }
-
-                            serve("/" + AtlasClient.BASE_URI + "*").with(GuiceContainer.class, initParams);
-                        }
-
-                        private void configureActiveServerFilterIfNecessary() {
-                            Configuration configuration = getConfiguration();
-                            if ((configuration == null) ||
-                                    !HAConfiguration.isHAEnabled(configuration)) {
-                                LOG.info("HA configuration is disabled, not activating ActiveServerFilter");
-                            } else {
-                                filter("/*").through(ActiveServerFilter.class);
-                            }
-                        }
-
-                    });
-
-            LOG.info("Guice modules loaded");
-        }
-
-        return injector;
-    }
-
-    protected Module getRepositoryModule() {
-        return new RepositoryMetadataModule();
-    }
-
-    @Override
-    public void contextInitialized(ServletContextEvent servletContextEvent) {
-        super.contextInitialized(servletContextEvent);
-
-        installLogBridge();
-
-        startServices();
-    }
-
-    protected void startServices() {
-        LOG.info("Starting services");
-        Services services = injector.getInstance(Services.class);
-        services.start();
-    }
-
-    /**
-     * Maps jersey's java.util.logging to slf4j
-     */
-    private void installLogBridge() {
-        // Optionally remove existing handlers attached to j.u.l root logger
-        SLF4JBridgeHandler.removeHandlersForRootLogger();  // (since SLF4J 1.6.5)
-
-        // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
-        // the initialization phase of your application
-        SLF4JBridgeHandler.install();
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent servletContextEvent) {
-        LOG.info("Starting servlet context destroy");
-        if(injector != null) {
-            //stop services
-            stopServices();
-            
-            final AtlasGraph graph = AtlasGraphProvider.getGraphInstance();
-
-            try {
-                graph.shutdown();
-            } catch(Throwable t) {
-                LOG.warn("Error while shutting down graph", t);
-            }
-        }
-        super.contextDestroyed(servletContextEvent);
-    }
-
-    protected void stopServices() {
-        LOG.info("Stopping services");
-        Services services = injector.getInstance(Services.class);
-        services.stop();
-    }
-}
diff --git a/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java b/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
index cc2ef8a..e21656e 100644
--- a/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
+++ b/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
@@ -26,7 +26,9 @@
 import org.apache.hadoop.util.Shell;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -34,6 +36,7 @@
 /**
  * A class capable of performing a simple or kerberos login.
  */
+@Component
 public class LoginProcessor {
 
     private static final Logger LOG = LoggerFactory.getLogger(LoginProcessor.class);
@@ -46,6 +49,7 @@
      * Perform a SIMPLE login based on established OS identity or a kerberos based login using the configured
      * principal and keytab (via atlas-application.properties).
      */
+    @PostConstruct
     public void login() {
         // first, let's see if we're running in a hadoop cluster and have the env configured
         boolean isHadoopCluster = isHadoopCluster();
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 9fe1624..01f9a86 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -18,7 +18,6 @@
 
 package org.apache.atlas.web.resources;
 
-import com.google.inject.Inject;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
@@ -50,10 +49,13 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -80,6 +82,7 @@
  */
 @Path("admin")
 @Singleton
+@Service
 public class AdminResource {
     private static final Logger LOG = LoggerFactory.getLogger(AdminResource.class);
 
@@ -108,6 +111,10 @@
     private final AtlasTypeDefStore typesDefStore;
     private final AtlasEntityStore  entityStore;
     private static Configuration atlasProperties;
+    private final ExportService exportService;
+
+    @Inject
+    ApplicationContext applicationContext;
 
     static {
         try {
@@ -120,12 +127,13 @@
     @Inject
     public AdminResource(ServiceState serviceState, MetricsService metricsService,
                          AtlasTypeRegistry typeRegistry, AtlasTypeDefStore typeDefStore,
-                         AtlasEntityStore entityStore) {
+                         AtlasEntityStore entityStore, ExportService exportService) {
         this.serviceState               = serviceState;
         this.metricsService             = metricsService;
         this.typeRegistry               = typeRegistry;
         this.typesDefStore              = typeDefStore;
         this.entityStore                = entityStore;
+        this.exportService = exportService;
         this.importExportOperationLock  = new ReentrantLock();
     }
 
@@ -320,8 +328,6 @@
         ZipSink exportSink = null;
         try {
             exportSink = new ZipSink(httpServletResponse.getOutputStream());
-            ExportService exportService = new ExportService(this.typeRegistry);
-
             AtlasExportResult result = exportService.run(exportSink, request, Servlets.getUserName(httpServletRequest),
                                                          Servlets.getHostName(httpServletRequest),
                                                          AtlasAuthorizationUtils.getRequestIpAddress(httpServletRequest));
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
index 2fe6898..435659e 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
@@ -27,16 +27,12 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
@@ -45,6 +41,7 @@
  */
 @Path("lineage/hive")
 @Singleton
+@Service
 @Deprecated
 public class DataSetLineageResource {
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 19c5594..711cc04 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -22,17 +22,17 @@
 import com.google.common.base.Preconditions;
 import com.sun.jersey.api.core.ResourceContext;
 import org.apache.atlas.AtlasClient;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.EntityAuditEvent;
-import org.apache.atlas.AtlasClient.EntityResult;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.GuidMapping;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
@@ -40,8 +40,8 @@
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream;
 import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1;
 import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasEntityType;
+import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
@@ -62,6 +62,7 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -86,8 +87,9 @@
  * An entity is an "instance" of a Type.  Entities conform to the definition
  * of the Type they correspond with.
  */
-@Path("entities")
 @Singleton
+@Path("entities")
+@Service
 @Deprecated
 public class EntityResource {
 
@@ -100,6 +102,7 @@
     private final AtlasInstanceConverter restAdapters;
     private final AtlasEntityStore       entitiesStore;
     private final AtlasTypeRegistry      typeRegistry;
+    private final EntityREST entityREST;
 
     @Context
     UriInfo uriInfo;
@@ -114,11 +117,13 @@
      * @param metadataService metadata service handle
      */
     @Inject
-    public EntityResource(MetadataService metadataService, AtlasInstanceConverter restAdapters, AtlasEntityStore entitiesStore, AtlasTypeRegistry typeRegistry) {
+    public EntityResource(MetadataService metadataService, AtlasInstanceConverter restAdapters,
+                          AtlasEntityStore entitiesStore, AtlasTypeRegistry typeRegistry, EntityREST entityREST) {
         this.metadataService = metadataService;
         this.restAdapters    = restAdapters;
         this.entitiesStore   = entitiesStore;
         this.typeRegistry    = typeRegistry;
+        this.entityREST    = entityREST;
     }
 
     /**
@@ -159,7 +164,6 @@
                 LOG.debug("submitting entities {} ", entityJson);
             }
 
-            EntityREST               entityREST       = resourceContext.getResource(EntityREST.class);
             AtlasEntitiesWithExtInfo entitiesInfo     = restAdapters.toAtlasEntities(entities);
             EntityMutationResponse   mutationResponse = entityREST.createOrUpdate(entitiesInfo);
 
@@ -220,7 +224,7 @@
         return locationURI;
     }
 
-    private JSONObject getResponse(AtlasClient.EntityResult entityResult) throws AtlasException, JSONException {
+    private JSONObject getResponse(EntityResult entityResult) throws AtlasException, JSONException {
         CreateUpdateEntitiesResult result = new CreateUpdateEntitiesResult();
         result.setEntityResult(entityResult);
         return getResponse(result);
@@ -273,7 +277,6 @@
                 LOG.info("updating entities {} ", entityJson);
             }
 
-            EntityREST                 entityREST       = resourceContext.getResource(EntityREST.class);
             AtlasEntitiesWithExtInfo   entitiesInfo     = restAdapters.toAtlasEntities(entities);
             EntityMutationResponse     mutationResponse = entityREST.createOrUpdate(entitiesInfo);
             CreateUpdateEntitiesResult result           = restAdapters.toCreateUpdateEntitiesResult(mutationResponse);
@@ -311,7 +314,7 @@
         }
     }
 
-    private String getSample(AtlasClient.EntityResult entityResult) {
+    private String getSample(EntityResult entityResult) {
         String sample = getSample(entityResult.getCreatedEntities());
         if (sample == null) {
             sample = getSample(entityResult.getUpdateEntities());
@@ -585,7 +588,6 @@
             }
 
             EntityResult entityResult;
-            EntityREST entityREST = resourceContext.getResource(EntityREST.class);
 
             if (guids != null && !guids.isEmpty()) {
                 if (LOG.isDebugEnabled()) {
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
index 32c2cb8..77115d7 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
@@ -18,7 +18,6 @@
 
 package org.apache.atlas.web.resources;
 
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.catalog.BaseRequest;
 import org.apache.atlas.catalog.CollectionRequest;
 import org.apache.atlas.catalog.DefaultTypeSystem;
@@ -33,6 +32,7 @@
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.atlas.web.util.Servlets;
 import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -58,6 +58,7 @@
  */
 @Path("v1/entities")
 @Singleton
+@Service
 public class EntityService extends BaseService {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.EntityService");
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
index 9f4a0bd..cba8ccf 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
@@ -35,6 +35,7 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -48,6 +49,7 @@
 
 @Path("lineage")
 @Singleton
+@Service
 @Deprecated
 public class LineageResource {
     private static final Logger LOG = LoggerFactory.getLogger(DataSetLineageResource.class);
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
index 32b4cae..d29c8da 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
@@ -33,6 +33,7 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -52,6 +53,7 @@
  */
 @Path("discovery")
 @Singleton
+@Service
 @Deprecated
 public class MetadataDiscoveryResource {
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
index b13810f..05b197f 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
@@ -18,7 +18,6 @@
 
 package org.apache.atlas.web.resources;
 
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.catalog.*;
 import org.apache.atlas.catalog.exception.CatalogException;
 import org.apache.atlas.catalog.exception.InvalidPayloadException;
@@ -28,9 +27,9 @@
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.atlas.web.util.Servlets;
 import org.slf4j.Logger;
+import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
-import javax.inject.Singleton;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
@@ -52,7 +51,7 @@
  * Service which handles API requests for taxonomy and term resources.
  */
 @Path("v1/taxonomies")
-@Singleton
+@Component
 public class TaxonomyService extends BaseService {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.TaxonomyService");
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
index 424ca58..08121d8 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
@@ -35,6 +35,7 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -63,15 +64,18 @@
  */
 @Path("types")
 @Singleton
+@Service
 @Deprecated
 public class TypesResource {
     private static final Logger LOG = LoggerFactory.getLogger(TypesResource.class);
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.TypesResource");
     private static AtlasTypeRegistry typeRegistry;
+    private final TypesREST typesREST;
 
     @Inject
-    public TypesResource(AtlasTypeRegistry typeRegistry) {
+    public TypesResource(AtlasTypeRegistry typeRegistry, TypesREST typesREST) {
         this.typeRegistry = typeRegistry;
+        this.typesREST = typesREST;
     }
 
     @Context
@@ -95,7 +99,6 @@
             perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TypesResource.submit()");
         }
 
-        TypesREST typesRest = resourceContext.getResource(TypesREST.class);
         JSONArray typesResponse = new JSONArray();
 
         try {
@@ -106,7 +109,7 @@
             }
 
             AtlasTypesDef createTypesDef  = TypeConverterUtil.toAtlasTypesDef(typeDefinition, typeRegistry);
-            AtlasTypesDef createdTypesDef = typesRest.createAtlasTypeDefs(createTypesDef);
+            AtlasTypesDef createdTypesDef = typesREST.createAtlasTypeDefs(createTypesDef);
             List<String>  typeNames       = TypeConverterUtil.getTypeNames(createdTypesDef);
 
             for (int i = 0; i < typeNames.size(); i++) {
@@ -164,7 +167,6 @@
             perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TypesResource.update()");
         }
 
-        TypesREST typesRest = resourceContext.getResource(TypesREST.class);
         JSONArray typesResponse = new JSONArray();
         try {
             final String typeDefinition = Servlets.getRequestPayload(request);
@@ -174,7 +176,7 @@
             }
 
             AtlasTypesDef updateTypesDef  = TypeConverterUtil.toAtlasTypesDef(typeDefinition, typeRegistry);
-            AtlasTypesDef updatedTypesDef = typesRest.updateAtlasTypeDefs(updateTypesDef);
+            AtlasTypesDef updatedTypesDef = typesREST.updateAtlasTypeDefs(updateTypesDef);
             List<String>  typeNames       = TypeConverterUtil.getTypeNames(updatedTypesDef);
 
             for (int i = 0; i < typeNames.size(); i++) {
@@ -287,10 +289,9 @@
             perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TypesResource.getTypesByFilter(" + typeCategory + ", " + supertype + ", " + notsupertype + ")");
         }
 
-        TypesREST typesRest  = resourceContext.getResource(TypesREST.class);
         JSONObject response  = new JSONObject();
         try {
-            List<String> result = TypeConverterUtil.getTypeNames(typesRest.getTypeDefHeaders(request));
+            List<String> result = TypeConverterUtil.getTypeNames(typesREST.getTypeDefHeaders(request));
 
             response.put(AtlasClient.RESULTS, new JSONArray(result));
             response.put(AtlasClient.COUNT, result.size());
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
index edaf3ef..ea55021 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
@@ -23,6 +23,7 @@
 import org.apache.atlas.model.discovery.AtlasSearchResult;
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.atlas.web.util.Servlets;
+import org.springframework.stereotype.Service;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 
@@ -39,6 +40,7 @@
  */
 @Path("v2/search")
 @Singleton
+@Service
 public class DiscoveryREST {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.DiscoveryREST");
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
index 88222db..0f6eeb1 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
@@ -26,11 +26,9 @@
 import org.apache.atlas.model.instance.ClassificationAssociateRequest;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
-import org.apache.atlas.repository.converters.AtlasInstanceConverter;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream;
 import org.apache.atlas.repository.store.graph.v1.EntityStream;
-import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -40,6 +38,7 @@
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -66,22 +65,18 @@
  */
 @Path("v2/entity")
 @Singleton
+@Service
 public class EntityREST {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.EntityREST");
 
     public static final String PREFIX_ATTR = "attr:";
 
     private final AtlasTypeRegistry         typeRegistry;
-    private final AtlasInstanceConverter    instanceConverter;
-    private final MetadataService           metadataService;
     private final AtlasEntityStore          entitiesStore;
 
     @Inject
-    public EntityREST(AtlasTypeRegistry typeRegistry, AtlasInstanceConverter instanceConverter,
-                      MetadataService metadataService, AtlasEntityStore entitiesStore) {
+    public EntityREST(AtlasTypeRegistry typeRegistry, AtlasEntityStore entitiesStore) {
         this.typeRegistry    = typeRegistry;
-        this.instanceConverter = instanceConverter;
-        this.metadataService = metadataService;
         this.entitiesStore   = entitiesStore;
     }
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
index 2b19e73..8638ea6 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
@@ -26,6 +26,7 @@
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.atlas.web.util.Servlets;
 import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -44,6 +45,7 @@
  */
 @Path("v2/lineage")
 @Singleton
+@Service
 public class LineageREST {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.LineageREST");
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
index 5d846cf..c32f36e 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
@@ -17,7 +17,6 @@
  */
 package org.apache.atlas.web.rest;
 
-import com.google.inject.Inject;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
@@ -33,7 +32,9 @@
 import org.apache.atlas.web.util.Servlets;
 import org.apache.http.annotation.Experimental;
 import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
@@ -53,6 +54,7 @@
  */
 @Path("v2/types")
 @Singleton
+@Service
 public class TypesREST {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.TypesREST");
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
index d78990b..b123c52 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasADAuthenticationProvider.java
@@ -18,11 +18,6 @@
 
 package org.apache.atlas.web.security;
 
-import java.util.List;
-import java.util.Properties;
-
-import javax.annotation.PostConstruct;
-
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.web.model.User;
 import org.apache.commons.configuration.Configuration;
@@ -32,7 +27,6 @@
 import org.springframework.ldap.core.support.LdapContextSource;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.ldap.DefaultSpringSecurityContextSource;
@@ -42,9 +36,12 @@
 import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+import java.util.List;
+import java.util.Properties;
+
 @Component
-public class AtlasADAuthenticationProvider extends
-        AtlasAbstractAuthenticationProvider {
+public class AtlasADAuthenticationProvider extends AtlasAbstractAuthenticationProvider {
     private static Logger LOG = LoggerFactory.getLogger(AtlasADAuthenticationProvider.class);
 
     private String adURL;
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
index e55d2cf..f77cb01 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
@@ -19,12 +19,9 @@
 
 package org.apache.atlas.web.security;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.Groups;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.AuthenticationProvider;
@@ -35,14 +32,15 @@
 import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
 
-public abstract class AtlasAbstractAuthenticationProvider implements
-        AuthenticationProvider {
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AtlasAbstractAuthenticationProvider implements AuthenticationProvider {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAbstractAuthenticationProvider.class);
 
     @Override
     public boolean supports(Class<?> authentication) {
-        return UsernamePasswordAuthenticationToken.class
-                .isAssignableFrom(authentication);
+        return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication);
     }
 
     /**
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
index 49a7e86..a117df6 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationFailureHandler.java
@@ -18,12 +18,12 @@
 
 package org.apache.atlas.web.security;
 
+import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.simple.JSONObject;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.AuthenticationFailureHandler;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -31,6 +31,7 @@
 import java.io.IOException;
 
 
+@Component
 public class AtlasAuthenticationFailureHandler implements AuthenticationFailureHandler {
 
     private static Logger LOG = LoggerFactory.getLogger(AtlasAuthenticationFailureHandler.class);
@@ -43,14 +44,12 @@
         LOG.debug("Login Failure ", e);
 
         JSONObject json = new JSONObject();
-        ObjectMapper mapper = new ObjectMapper();
         json.put("msgDesc", e.getMessage());
 
-        String jsonAsStr = mapper.writeValueAsString(json);
         response.setContentType("application/json");
         response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
         response.setCharacterEncoding("UTF-8");
-        response.getWriter().write(jsonAsStr);
+        response.getWriter().write(json.toJSONString());
 
     }
 }
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationProvider.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationProvider.java
index 953d737..80d6604 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationProvider.java
@@ -17,20 +17,19 @@
  */
 package org.apache.atlas.web.security;
 
-import javax.annotation.PostConstruct;
-
+import org.apache.atlas.ApplicationProperties;
+import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.stereotype.Component;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.commons.configuration.Configuration;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 
 @Component
-public class AtlasAuthenticationProvider extends
-        AtlasAbstractAuthenticationProvider {
+public class AtlasAuthenticationProvider extends AtlasAbstractAuthenticationProvider {
     private static final Logger LOG = LoggerFactory
             .getLogger(AtlasAuthenticationProvider.class);
 
@@ -44,22 +43,27 @@
 
     private boolean ssoEnabled = false;
 
-    @Autowired
-    AtlasLdapAuthenticationProvider ldapAuthenticationProvider;
+    final AtlasLdapAuthenticationProvider ldapAuthenticationProvider;
 
-    @Autowired
-    AtlasFileAuthenticationProvider fileAuthenticationProvider;
+    final AtlasFileAuthenticationProvider fileAuthenticationProvider;
 
-    @Autowired
-    AtlasADAuthenticationProvider adAuthenticationProvider;
+    final AtlasADAuthenticationProvider adAuthenticationProvider;
+
+    @Inject
+    public AtlasAuthenticationProvider(AtlasLdapAuthenticationProvider ldapAuthenticationProvider,
+                                       AtlasFileAuthenticationProvider fileAuthenticationProvider,
+                                       AtlasADAuthenticationProvider adAuthenticationProvider) {
+        this.ldapAuthenticationProvider = ldapAuthenticationProvider;
+        this.fileAuthenticationProvider = fileAuthenticationProvider;
+        this.adAuthenticationProvider = adAuthenticationProvider;
+    }
 
     @PostConstruct
     void setAuthenticationMethod() {
         try {
             Configuration configuration = ApplicationProperties.get();
 
-            this.fileAuthenticationMethodEnabled = configuration.getBoolean(
-                    FILE_AUTH_METHOD, true);
+            this.fileAuthenticationMethodEnabled = configuration.getBoolean(FILE_AUTH_METHOD, true);
 
             boolean ldapAuthenticationEnabled = configuration.getBoolean(LDAP_AUTH_METHOD, false);
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
index 2942e8e..e7a5d66 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAuthenticationSuccessHandler.java
@@ -18,12 +18,12 @@
 
 package org.apache.atlas.web.security;
 
+import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.simple.JSONObject;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
+import org.springframework.stereotype.Component;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -31,6 +31,7 @@
 import java.io.IOException;
 
 
+@Component
 public class AtlasAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
 
     private static Logger LOG = LoggerFactory.getLogger(AuthenticationSuccessHandler.class);
@@ -41,7 +42,6 @@
         LOG.debug("Login Success " + authentication.getPrincipal());
 
         JSONObject json = new JSONObject();
-        ObjectMapper mapper = new ObjectMapper();
         json.put("msgDesc", "Success");
 
         if (request.getSession() != null) { // incase of form based login mark it as local login in session
@@ -49,10 +49,9 @@
             request.getServletContext().setAttribute(request.getSession().getId(), "locallogin");
         }
 
-        String jsonAsStr = mapper.writeValueAsString(json);
         response.setContentType("application/json");
         response.setStatus(HttpServletResponse.SC_OK);
         response.setCharacterEncoding("UTF-8");
-        response.getWriter().write(jsonAsStr);
+        response.getWriter().write(json.toJSONString());
     }
 }
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
index 1032b1c..f177fd4 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasFileAuthenticationProvider.java
@@ -16,12 +16,9 @@
  */
 package org.apache.atlas.web.security;
 
-import java.util.Collection;
-
 import org.apache.atlas.web.dao.UserDao;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -30,6 +27,9 @@
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+import java.util.Collection;
  
 
 @Component
@@ -37,8 +37,12 @@
 
     private static Logger logger = LoggerFactory.getLogger(AtlasFileAuthenticationProvider.class);
 
-    @Autowired
-    private UserDetailsService userDetailsService;
+    private final UserDetailsService userDetailsService;
+
+    @Inject
+    public AtlasFileAuthenticationProvider(UserDetailsService userDetailsService) {
+        this.userDetailsService = userDetailsService;
+    }
 
     @Override
     public Authentication authenticate(Authentication authentication) throws AuthenticationException {
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java
new file mode 100644
index 0000000..6b512af
--- /dev/null
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java
@@ -0,0 +1,169 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.web.security;
+
+import org.apache.atlas.web.filters.ActiveServerFilter;
+import org.apache.atlas.web.filters.AtlasAuthenticationEntryPoint;
+import org.apache.atlas.web.filters.AtlasAuthenticationFilter;
+import org.apache.atlas.web.filters.AtlasAuthorizationFilter;
+import org.apache.atlas.web.filters.AtlasCSRFPreventionFilter;
+import org.apache.atlas.web.filters.AtlasKnoxSSOAuthenticationFilter;
+import org.apache.atlas.web.filters.StaleTransactionCleanupFilter;
+import org.apache.commons.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
+import org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint;
+import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
+import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
+import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter;
+import org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher;
+import org.springframework.security.web.util.matcher.RequestMatcher;
+
+import javax.inject.Inject;
+import java.util.LinkedHashMap;
+
+@EnableWebSecurity
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class AtlasSecurityConfig extends WebSecurityConfigurerAdapter {
+    private static final Logger LOG = LoggerFactory.getLogger(AtlasSecurityConfig.class);
+
+    private final AtlasAuthenticationProvider authenticationProvider;
+    private final AtlasAuthenticationSuccessHandler successHandler;
+    private final AtlasAuthenticationFailureHandler failureHandler;
+    private final AtlasAuthorizationFilter atlasAuthorizationFilter;
+    private final AtlasKnoxSSOAuthenticationFilter ssoAuthenticationFilter;
+    private final AtlasAuthenticationFilter atlasAuthenticationFilter;
+    private final AtlasCSRFPreventionFilter csrfPreventionFilter;
+    private final AtlasAuthenticationEntryPoint atlasAuthenticationEntryPoint;
+
+    // Our own Atlas filters need to be registered as well
+    private final Configuration configuration;
+    private final StaleTransactionCleanupFilter staleTransactionCleanupFilter;
+    private final ActiveServerFilter activeServerFilter;
+
+    @Inject
+    public AtlasSecurityConfig(AtlasKnoxSSOAuthenticationFilter ssoAuthenticationFilter,
+                               AtlasCSRFPreventionFilter atlasCSRFPreventionFilter,
+                               AtlasAuthenticationFilter atlasAuthenticationFilter,
+                               AtlasAuthenticationProvider authenticationProvider,
+                               AtlasAuthenticationSuccessHandler successHandler,
+                               AtlasAuthenticationFailureHandler failureHandler,
+                               AtlasAuthorizationFilter atlasAuthorizationFilter,
+                               AtlasAuthenticationEntryPoint atlasAuthenticationEntryPoint,
+                               Configuration configuration,
+                               StaleTransactionCleanupFilter staleTransactionCleanupFilter,
+                               ActiveServerFilter activeServerFilter) {
+        this.ssoAuthenticationFilter = ssoAuthenticationFilter;
+        this.csrfPreventionFilter = atlasCSRFPreventionFilter;
+        this.atlasAuthenticationFilter = atlasAuthenticationFilter;
+        this.authenticationProvider = authenticationProvider;
+        this.successHandler = successHandler;
+        this.failureHandler = failureHandler;
+        this.atlasAuthorizationFilter = atlasAuthorizationFilter;
+        this.atlasAuthenticationEntryPoint = atlasAuthenticationEntryPoint;
+        this.configuration = configuration;
+        this.staleTransactionCleanupFilter = staleTransactionCleanupFilter;
+        this.activeServerFilter = activeServerFilter;
+    }
+
+    public BasicAuthenticationEntryPoint getAuthenticationEntryPoint() {
+        BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint();
+        basicAuthenticationEntryPoint.setRealmName("atlas.com");
+        return basicAuthenticationEntryPoint;
+    }
+
+    public DelegatingAuthenticationEntryPoint getDelegatingAuthenticationEntryPoint() {
+        LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPointMap = new LinkedHashMap<>();
+        entryPointMap.put(new RequestHeaderRequestMatcher("User-Agent", "Mozilla"), atlasAuthenticationEntryPoint);
+        DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(entryPointMap);
+        entryPoint.setDefaultEntryPoint(getAuthenticationEntryPoint());
+        return entryPoint;
+    }
+
+    @Inject
+    protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) {
+        authenticationManagerBuilder.authenticationProvider(authenticationProvider);
+    }
+
+    @Override
+    public void configure(WebSecurity web) throws Exception {
+        web.ignoring()
+                .antMatchers("/login.jsp",
+                        "/css/**",
+                        "/img/**",
+                        "/libs/**",
+                        "/js/**",
+                        "/ieerror.html",
+                        "/api/atlas/admin/status",
+                        "/api/atlas/admin/metrics");
+    }
+
+    protected void configure(HttpSecurity httpSecurity) throws Exception {
+
+        //@formatter:off
+        httpSecurity
+                .authorizeRequests().anyRequest().authenticated()
+                .and()
+                    .headers().disable()
+                    .servletApi()
+                .and()
+                    .csrf().disable()
+                    .sessionManagement()
+                    .enableSessionUrlRewriting(false)
+                    .sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
+                    .sessionFixation()
+                    .newSession()
+                .and()
+                    .formLogin()
+                        .loginPage("/login.jsp")
+                        .loginProcessingUrl("/j_spring_security_check")
+                        .successHandler(successHandler)
+                        .failureHandler(failureHandler)
+                        .usernameParameter("j_username")
+                        .passwordParameter("j_password")
+                .and()
+                    .logout()
+                        .logoutSuccessUrl("/login.jsp")
+                        .deleteCookies("ATLASSESSIONID")
+                        .logoutUrl("/logout.html")
+                .and()
+                    .httpBasic()
+                    .authenticationEntryPoint(getDelegatingAuthenticationEntryPoint());
+        //@formatter:on
+
+        if (configuration.getBoolean("atlas.server.ha.enabled", false)) {
+            LOG.info("Atlas is in HA Mode, enabling ActiveServerFilter");
+            httpSecurity.addFilterAfter(activeServerFilter, BasicAuthenticationFilter.class);
+        }
+        httpSecurity
+                .addFilterAfter(staleTransactionCleanupFilter, BasicAuthenticationFilter.class)
+                .addFilterAfter(ssoAuthenticationFilter, BasicAuthenticationFilter.class)
+                .addFilterAfter(atlasAuthenticationFilter, SecurityContextHolderAwareRequestFilter.class)
+                .addFilterAfter(csrfPreventionFilter, AtlasAuthenticationFilter.class)
+                .addFilterAfter(atlasAuthorizationFilter, FilterSecurityInterceptor.class);
+    }
+}
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorModule.java b/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorModule.java
deleted file mode 100644
index 1f67f9f..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorModule.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.service;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.atlas.listener.ActiveStateChangeHandler;
-import org.apache.atlas.notification.NotificationHookConsumer;
-import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
-import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
-import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1;
-import org.apache.atlas.service.Service;
-import org.apache.atlas.services.DefaultMetadataService;
-
-/**
- * A Guice module that registers the handlers of High Availability state change handlers and other services.
- *
- * Any new handler that should react to HA state change should be registered here.
- */
-public class ActiveInstanceElectorModule extends AbstractModule {
-    @Override
-    protected void configure() {
-        Multibinder<ActiveStateChangeHandler> activeStateChangeHandlerBinder =
-                Multibinder.newSetBinder(binder(), ActiveStateChangeHandler.class);
-        activeStateChangeHandlerBinder.addBinding().to(GraphBackedSearchIndexer.class);
-        activeStateChangeHandlerBinder.addBinding().to(DefaultMetadataService.class);
-        activeStateChangeHandlerBinder.addBinding().to(NotificationHookConsumer.class);
-        activeStateChangeHandlerBinder.addBinding().to(HBaseBasedAuditRepository.class);
-        activeStateChangeHandlerBinder.addBinding().to(AtlasTypeDefGraphStoreV1.class);
-
-        Multibinder<Service> serviceBinder = Multibinder.newSetBinder(binder(), Service.class);
-        serviceBinder.addBinding().to(ActiveInstanceElectorService.class);
-    }
-}
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorService.java b/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorService.java
index 8e649f7..5071204 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceElectorService.java
@@ -18,10 +18,6 @@
 
 package org.apache.atlas.web.service;
 
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.ha.AtlasServerIdSelector;
 import org.apache.atlas.ha.HAConfiguration;
@@ -32,10 +28,14 @@
 import org.apache.curator.framework.recipes.leader.LeaderLatchListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Set;
 
 /**
  * A service that implements leader election to determine whether this Atlas server is Active.
@@ -47,7 +47,9 @@
  * on being removed from leadership, this instance is treated as a passive instance and calls
  * {@link ActiveStateChangeHandler}s to deactivate them.
  */
-@Singleton
+
+@Component
+@Order(1)
 public class ActiveInstanceElectorService implements Service, LeaderLatchListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(ActiveInstanceElectorService.class);
@@ -55,7 +57,7 @@
     private final Configuration configuration;
     private final ServiceState serviceState;
     private final ActiveInstanceState activeInstanceState;
-    private Collection<Provider<ActiveStateChangeHandler>> activeStateChangeHandlerProviders;
+    private Set<ActiveStateChangeHandler> activeStateChangeHandlerProviders;
     private Collection<ActiveStateChangeHandler> activeStateChangeHandlers;
     private CuratorFactory curatorFactory;
     private LeaderLatch leaderLatch;
@@ -68,17 +70,8 @@
      * @throws AtlasException
      */
     @Inject
-    public ActiveInstanceElectorService(
-            Collection<Provider<ActiveStateChangeHandler>> activeStateChangeHandlerProviders,
-            CuratorFactory curatorFactory, ActiveInstanceState activeInstanceState,
-            ServiceState serviceState)
-            throws AtlasException {
-        this(ApplicationProperties.get(), activeStateChangeHandlerProviders,
-                curatorFactory, activeInstanceState, serviceState);
-    }
-
     ActiveInstanceElectorService(Configuration configuration,
-                                 Collection<Provider<ActiveStateChangeHandler>> activeStateChangeHandlerProviders,
+                                 Set<ActiveStateChangeHandler> activeStateChangeHandlerProviders,
                                  CuratorFactory curatorFactory, ActiveInstanceState activeInstanceState,
                                  ServiceState serviceState) {
         this.configuration = configuration;
@@ -164,10 +157,7 @@
 
     private void cacheActiveStateChangeHandlers() {
         if (activeStateChangeHandlers.size()==0) {
-            for (Provider<ActiveStateChangeHandler> provider : activeStateChangeHandlerProviders) {
-                ActiveStateChangeHandler handler = provider.get();
-                activeStateChangeHandlers.add(handler);
-            }
+            activeStateChangeHandlers.addAll(activeStateChangeHandlerProviders);
         }
     }
 
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java b/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java
index ee3b829..c6b4a6f 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java
@@ -18,7 +18,6 @@
 
 package org.apache.atlas.web.service;
 
-import com.google.inject.Inject;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
@@ -33,8 +32,10 @@
 import org.apache.zookeeper.data.Stat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 import scala.actors.threadpool.Arrays;
 
+import javax.inject.Inject;
 import java.nio.charset.Charset;
 import java.util.List;
 
@@ -45,6 +46,7 @@
  * under a read-write lock implemented using Curator's {@link InterProcessReadWriteLock} to
  * provide for safety across multiple processes.
  */
+@Component
 public class ActiveInstanceState {
 
     private final Configuration configuration;
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
index 50351f0..7c89055 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
@@ -20,7 +20,6 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Charsets;
-import com.google.inject.Singleton;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.ha.HAConfiguration;
@@ -36,7 +35,9 @@
 import org.apache.zookeeper.data.ACL;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
+import javax.inject.Singleton;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
@@ -47,6 +48,7 @@
  * Allows for stubbing in tests.
  */
 @Singleton
+@Component
 public class CuratorFactory {
 
     private static final Logger LOG = LoggerFactory.getLogger(CuratorFactory.class);
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ServiceModule.java b/webapp/src/main/java/org/apache/atlas/web/service/ServiceModule.java
deleted file mode 100644
index 2128b7c..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/service/ServiceModule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.service;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.atlas.kafka.KafkaNotification;
-import org.apache.atlas.listener.EntityChangeListener;
-import org.apache.atlas.notification.NotificationHookConsumer;
-import org.apache.atlas.notification.NotificationEntityChangeListener;
-import org.apache.atlas.service.Service;
-
-public class ServiceModule extends AbstractModule {
-    @Override
-    protected void configure() {
-        Multibinder<Service> serviceBinder = Multibinder.newSetBinder(binder(), Service.class);
-        serviceBinder.addBinding().to(KafkaNotification.class);
-        serviceBinder.addBinding().to(NotificationHookConsumer.class);
-
-        //Add NotificationEntityChangeListener as EntityChangeListener
-        Multibinder<EntityChangeListener> entityChangeListenerBinder =
-                Multibinder.newSetBinder(binder(), EntityChangeListener.class);
-        entityChangeListenerBinder.addBinding().to(NotificationEntityChangeListener.class);
-    }
-}
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java b/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java
index 2d9e00a..3fe8d18 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java
@@ -19,13 +19,15 @@
 package org.apache.atlas.web.service;
 
 import com.google.common.base.Preconditions;
-import com.google.inject.Singleton;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.ha.HAConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Singleton;
 
 /**
  * A class that maintains the state of this instance.
@@ -34,6 +36,7 @@
  * directed by {@link ActiveInstanceElectorService}.
  */
 @Singleton
+@Component
 public class ServiceState {
 
     private static final Logger LOG = LoggerFactory.getLogger(ServiceState.class);
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/UserService.java b/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
index 6e5c210..24fd7cf 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
@@ -17,18 +17,23 @@
 
 package org.apache.atlas.web.service;
 
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.atlas.web.dao.UserDao;
+import org.apache.atlas.web.model.User;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
-import org.apache.atlas.web.dao.UserDao;
-import org.apache.atlas.web.model.User;
+
+import javax.inject.Inject;
 
 @Service
 public class UserService implements UserDetailsService {
 
-    @Autowired
-    private UserDao userDao;
+    private final UserDao userDao;
+
+    @Inject
+    public UserService(UserDao userDao) {
+        this.userDao = userDao;
+    }
 
     @Override
     public User loadUserByUsername(final String username)
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java b/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
deleted file mode 100644
index 41eccd1..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetup.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.setup;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.setup.SetupException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An application that is used to setup dependencies for the Atlas web service.
- *
- * This should be executed immediately after installation with the same configuration
- * as the Atlas web service itself. The application runs all steps registered with {@link SetupSteps}.
- */
-public class AtlasSetup {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AtlasSetup.class);
-
-    private final Injector injector;
-
-    public AtlasSetup() {
-        injector = Guice.createInjector(new AtlasSetupModule());
-        LOG.info("Got injector: {}", injector);
-    }
-
-    public static void main(String[] args) {
-        try {
-            AtlasSetup atlasSetup = new AtlasSetup();
-            atlasSetup.run();
-            LOG.info("Finished running all setup steps.");
-        } catch (SetupException e) {
-            LOG.error("Could not run setup step.", e);
-        }
-    }
-
-    public void run() throws SetupException {
-        SetupSteps setupSteps = injector.getInstance(SetupSteps.class);
-        LOG.info("Got setup steps.");
-        try {
-            setupSteps.runSetup(ApplicationProperties.get());
-        } catch (AtlasException e) {
-            throw new SetupException("Cannot get application properties.", e);
-        }
-    }
-}
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetupModule.java b/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetupModule.java
deleted file mode 100644
index 6edfb12..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/setup/AtlasSetupModule.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.setup;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.atlas.repository.graph.GraphSchemaInitializer;
-import org.apache.atlas.setup.SetupStep;
-
-public class AtlasSetupModule extends AbstractModule {
-    @Override
-    protected void configure() {
-        Multibinder<SetupStep> setupStepMultibinder = Multibinder.newSetBinder(binder(), SetupStep.class);
-        setupStepMultibinder.addBinding().to(GraphSchemaInitializer.class);
-    }
-}
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
index eadd5ce..cfb49b6 100644
--- a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
+++ b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
@@ -19,8 +19,7 @@
 package org.apache.atlas.web.setup;
 
 import com.google.common.base.Charsets;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.ha.AtlasServerIdSelector;
@@ -37,32 +36,44 @@
 import org.apache.zookeeper.data.Stat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Condition;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
 
 @Singleton
+@Component
+@Conditional(SetupSteps.SetupRequired.class)
 public class SetupSteps {
     private static final Logger LOG = LoggerFactory.getLogger(SetupSteps.class);
     public static final String SETUP_IN_PROGRESS_NODE = "/setup_in_progress";
 
     private final Set<SetupStep> setupSteps;
+    private final Configuration configuration;
     private CuratorFactory curatorFactory;
 
     @Inject
-    public SetupSteps(Set<SetupStep> steps, CuratorFactory curatorFactory) {
+    public SetupSteps(Set<SetupStep> steps, CuratorFactory curatorFactory, Configuration configuration) {
         setupSteps = steps;
         this.curatorFactory = curatorFactory;
+        this.configuration = configuration;
     }
 
     /**
      * Call each registered {@link SetupStep} one after the other.
      * @throws SetupException Thrown with any error during running setup, including Zookeeper interactions, and
      *                          individual failures in the {@link SetupStep}.
-     * @param configuration Configuration for Atlas server.
      */
-    public void runSetup(Configuration configuration) throws SetupException {
+    @PostConstruct
+    public void runSetup() throws SetupException {
         HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
         InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot());
         try {
@@ -162,4 +173,25 @@
             throw new SetupException("Could not create lock node before running setup.", e);
         }
     }
+
+    static class SetupRequired implements Condition {
+        private static final String ATLAS_SERVER_RUN_SETUP_KEY = "atlas.server.run.setup.on.start";
+
+        @Override
+        public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
+            try {
+                Configuration configuration = ApplicationProperties.get();
+                boolean shouldRunSetup = configuration.getBoolean(ATLAS_SERVER_RUN_SETUP_KEY, false);
+                if (shouldRunSetup) {
+                    LOG.warn("Running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
+                    return true;
+                } else {
+                    LOG.info("Not running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
+                }
+            } catch (AtlasException e) {
+                LOG.error("Unable to read config to determine if setup is needed. Not running setup.");
+            }
+            return false;
+        }
+    }
 }
diff --git a/webapp/src/main/resources/spring-security.xml b/webapp/src/main/resources/spring-security.xml
index 208c325..1743218 100644
--- a/webapp/src/main/resources/spring-security.xml
+++ b/webapp/src/main/resources/spring-security.xml
@@ -1,30 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-    license agreements. See the NOTICE file distributed with this work for additional 
-    information regarding copyright ownership. The ASF licenses this file to 
-    You under the Apache License, Version 2.0 (the "License"); you may not use 
-    this file except in compliance with the License. You may obtain a copy of 
-    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-    by applicable law or agreed to in writing, software distributed under the 
-    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-    OF ANY KIND, either express or implied. See the License for the specific 
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+    license agreements. See the NOTICE file distributed with this work for additional
+    information regarding copyright ownership. The ASF licenses this file to
+    You under the Apache License, Version 2.0 (the "License"); you may not use
+    this file except in compliance with the License. You may obtain a copy of
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+    by applicable law or agreed to in writing, software distributed under the
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+    OF ANY KIND, either express or implied. See the License for the specific
     language governing permissions and limitations under the License. -->
 
 <beans:beans xmlns="http://www.springframework.org/schema/security"
              xmlns:beans="http://www.springframework.org/schema/beans"
-             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:security="http://www.springframework.org/schema/security"
-             xmlns:context="http://www.springframework.org/schema/context"
-             xsi:schemaLocation="http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-    http://www.springframework.org/schema/security
-    http://www.springframework.org/schema/security/spring-security-3.1.xsd
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+						http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
 
-
-
-
-    http://www.springframework.org/schema/context 
-    http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+    <!-- This XML is no longer being used, @see AtlasSecurityConfig for the equivalent java config -->
 
     <security:http pattern="/login.jsp" security="none" />
     <security:http pattern="/css/**" security="none" />
@@ -35,8 +28,7 @@
     <security:http pattern="/api/atlas/admin/status" security="none" />
     <security:http pattern="/api/atlas/admin/metrics" security="none" />
 
-    <security:http disable-url-rewriting="true"
-                   use-expressions="true" create-session="always"
+    <security:http create-session="always"
                    entry-point-ref="entryPoint">
         <security:session-management
                 session-fixation-protection="newSession" />
@@ -48,6 +40,7 @@
 
         <form-login
                 login-page="/login.jsp"
+                login-processing-url="/j_spring_security_check"
                 authentication-success-handler-ref="atlasAuthenticationSuccessHandler"
                 authentication-failure-handler-ref="atlasAuthenticationFailureHandler"
                 username-parameter="j_username"
@@ -56,6 +49,8 @@
         <security:logout logout-success-url="/login.jsp" delete-cookies="ATLASSESSIONID"
                          logout-url="/logout.html" />
         <http-basic />
+        <headers disabled="true"/>
+        <csrf disabled="true"/>
         <security:custom-filter position="LAST" ref="atlasAuthorizationFilter"/>
     </security:http>
 
@@ -76,7 +71,7 @@
 
     <beans:bean id="formAuthenticationEntryPoint"
                 class="org.apache.atlas.web.filters.AtlasAuthenticationEntryPoint">
-        <beans:property name="loginFormUrl" value="/login.jsp" />
+        <beans:constructor-arg value="/login.jsp"/>
     </beans:bean>
 
     <beans:bean id="authenticationEntryPoint"
@@ -108,7 +103,5 @@
     <security:global-method-security
             pre-post-annotations="enabled" />
 
-    <context:component-scan base-package="org.apache.atlas.web" />
-    
     <beans:bean id = "atlasAuthorizationFilter" class="org.apache.atlas.web.filters.AtlasAuthorizationFilter"/>
-</beans:beans>
+</beans:beans>
\ No newline at end of file
diff --git a/webapp/src/main/webapp/WEB-INF/applicationContext.xml b/webapp/src/main/webapp/WEB-INF/applicationContext.xml
index d4ad14e..aae2aa0 100644
--- a/webapp/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/webapp/src/main/webapp/WEB-INF/applicationContext.xml
@@ -12,9 +12,12 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
-	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
+	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
 
-        <import resource="classpath:/spring-security.xml" />
-
+        <context:annotation-config/>
+        <aop:config proxy-target-class="true"/>
+        <context:component-scan base-package="org.apache.atlas" />
 </beans>
\ No newline at end of file
diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml
index f7e2028..d2d08f5 100755
--- a/webapp/src/main/webapp/WEB-INF/web.xml
+++ b/webapp/src/main/webapp/WEB-INF/web.xml
@@ -24,51 +24,46 @@
     <display-name>Apache Atlas</display-name>
     <description>Metadata Management and Data Governance Platform over Hadoop</description>
 
-    <context-param>
-        <param-name>guice.packages</param-name>
-        <param-value>
-            org.apache.atlas.web.resources,org.apache.atlas.web.params,org.apache.atlas.web.rest,org.apache.atlas.web.errors
-        </param-value>
-    </context-param>
-  
-    <context-param>
-        <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
-        <param-value>true</param-value>
-    </context-param>
+    <servlet>
+        <servlet-name>jersey-servlet</servlet-name>
+        <servlet-class>
+            com.sun.jersey.spi.spring.container.servlet.SpringServlet
+        </servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
 
-    <!--
-        More information can be found here:
-
-        https://jersey.java.net/nonav/apidocs/1.11/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html
-     -->
+    <servlet-mapping>
+        <servlet-name>jersey-servlet</servlet-name>
+        <url-pattern>/api/atlas/*</url-pattern>
+    </servlet-mapping>
 
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
-    
-    <filter>
-        <filter-name>guiceFilter</filter-name>
-        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
-    </filter>
-    
+
     <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-    
+
+    <filter>
+        <filter-name>AuditFilter</filter-name>
+        <filter-class>org.apache.atlas.web.filters.AuditFilter</filter-class>
+    </filter>
+
     <filter-mapping>
-        <filter-name>guiceFilter</filter-name>
+        <filter-name>AuditFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
 
     <listener>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
     </listener>
-    
-    <listener>
-        <listener-class>org.apache.atlas.web.listeners.GuiceServletConfig</listener-class>
-    </listener>
 
     <listener>
         <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
@@ -88,5 +83,5 @@
         </cookie-config>
     </session-config>
 
-	
+
 </web-app>
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
index 06c78be..592c2a6 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
@@ -22,7 +22,7 @@
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.web.resources.BaseResourceIT;
+import org.apache.atlas.web.integration.BaseResourceIT;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
index 7f3192a..773a514 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
@@ -26,9 +26,8 @@
 import org.apache.atlas.model.lineage.AtlasLineageInfo;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
-import org.apache.atlas.web.resources.BaseResourceIT;
+import org.apache.atlas.web.integration.BaseResourceIT;
 import org.codehaus.jettison.json.JSONException;
-import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
diff --git a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
index 29be942..ac3b538 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
@@ -19,8 +19,8 @@
 package org.apache.atlas.notification;
 
 import com.google.common.collect.ImmutableSet;
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasClient;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.notification.entity.EntityNotification;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.IStruct;
@@ -32,9 +32,8 @@
 import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
 import org.apache.atlas.typesystem.types.TraitType;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.apache.atlas.web.resources.BaseResourceIT;
+import org.apache.atlas.web.integration.BaseResourceIT;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import java.util.Collections;
@@ -48,13 +47,11 @@
 /**
  * Entity Notification Integration Tests.
  */
-@Guice(modules = NotificationModule.class)
 public class EntityNotificationIT extends BaseResourceIT {
 
     private final String DATABASE_NAME = "db" + randomString();
     private final String TABLE_NAME = "table" + randomString();
-    @Inject
-    private NotificationInterface notificationInterface;
+    private NotificationInterface notificationInterface = NotificationProvider.get();
     private Id tableId;
     private Id dbId;
     private String traitName;
diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
index 1c2cdc6..9c5597e 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
@@ -18,23 +18,21 @@
 
 package org.apache.atlas.notification;
 
-import com.google.inject.Inject;
 import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.notification.hook.HookNotification;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.web.resources.BaseResourceIT;
+import org.apache.atlas.web.integration.BaseResourceIT;
 import org.codehaus.jettison.json.JSONArray;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import java.util.List;
 
 import static org.testng.Assert.assertEquals;
 
-@Guice(modules = NotificationModule.class)
 public class NotificationHookConsumerIT extends BaseResourceIT {
 
     private static final String TEST_USER = "testuser";
@@ -43,8 +41,7 @@
     public static final String QUALIFIED_NAME = "qualifiedName";
     public static final String CLUSTER_NAME = "clusterName";
 
-    @Inject
-    private NotificationInterface kafka;
+    private NotificationInterface notificationInterface = NotificationProvider.get();
 
     @BeforeClass
     public void setUp() throws Exception {
@@ -54,11 +51,11 @@
 
     @AfterClass
     public void teardown() throws Exception {
-        kafka.close();
+        notificationInterface.close();
     }
 
     private void sendHookMessage(HookNotification.HookNotificationMessage message) throws NotificationException {
-        kafka.send(NotificationInterface.NotificationType.HOOK, message);
+        notificationInterface.send(NotificationInterface.NotificationType.HOOK, message);
     }
 
     @Test
diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
index e744e2e..18fd2ee 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
@@ -18,12 +18,12 @@
 
 package org.apache.atlas.notification;
 
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.kafka.KafkaNotification;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.notification.hook.HookNotification;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
@@ -39,7 +39,6 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import static org.mockito.Matchers.any;
@@ -47,14 +46,12 @@
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.*;
 
-@Guice(modules = NotificationModule.class)
 public class NotificationHookConsumerKafkaTest {
 
     public static final String NAME = "name";
     public static final String DESCRIPTION = "description";
     public static final String QUALIFIED_NAME = "qualifiedName";
-    @Inject
-    private NotificationInterface notificationInterface;
+    private NotificationInterface notificationInterface = NotificationProvider.get();
 
 
     @Mock
diff --git a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
index 9272203..e753881 100644
--- a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+++ b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
@@ -20,7 +20,7 @@
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.RequestContextV1;
-import org.apache.atlas.TestOnlyModule;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
@@ -32,7 +32,6 @@
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasType;
@@ -42,7 +41,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Guice;
@@ -57,7 +55,7 @@
 import java.util.Map;
 
 
-@Guice(modules = {TestOnlyModule.class})
+@Guice(modules = {TestModules.TestOnlyModule.class})
 public class TestEntitiesREST {
 
     private static final Logger LOG = LoggerFactory.getLogger(TestEntitiesREST.class);
@@ -105,11 +103,6 @@
         RequestContextV1.clear();
     }
 
-    @AfterClass
-    public void tearDown() throws Exception {
-        AtlasGraphProvider.cleanup();
-    }
-
     @Test
     public void testCreateOrUpdateEntities() throws Exception {
         AtlasEntitiesWithExtInfo entities = new AtlasEntitiesWithExtInfo();
diff --git a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
index cadf0ff..b90ea64 100644
--- a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
+++ b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
@@ -17,9 +17,9 @@
  */
 package org.apache.atlas.web.adapters;
 
+import org.apache.atlas.TestModules;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.RequestContextV1;
-import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
@@ -30,7 +30,6 @@
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.atlas.web.rest.EntityREST;
@@ -50,7 +49,7 @@
 import java.util.List;
 import java.util.Map;
 
-@Guice(modules = {TestOnlyModule.class})
+@Guice(modules = {TestModules.TestOnlyModule.class})
 public class TestEntityREST {
 
     @Inject
@@ -73,7 +72,7 @@
 
     @AfterClass
     public void tearDown() throws Exception {
-        AtlasGraphProvider.cleanup();
+//        AtlasGraphProvider.cleanup();
     }
 
     @AfterMethod
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
similarity index 97%
rename from webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
index 177785c..cfe09d6 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import org.apache.atlas.AtlasClient;
 import org.apache.commons.configuration.PropertiesConfiguration;
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/BaseResourceIT.java
similarity index 85%
rename from webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/BaseResourceIT.java
index 457dc39..b59d3ee 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/BaseResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -47,7 +47,6 @@
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.atlas.typesystem.json.TypesSerialization;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.types.*;
@@ -62,6 +61,7 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -76,7 +76,7 @@
 
 /**
  * Base class for integration tests.
- * Sets up the web resource and has helper methods to create type and entity.
+ * Sets up the web resource and has helper methods to created type and entity.
  */
 public abstract class BaseResourceIT {
 
@@ -119,119 +119,99 @@
         }
     }
 
-    protected void batchCreateTypes(AtlasTypesDef typesDef) throws AtlasServiceException { 
+    protected void batchCreateTypes(AtlasTypesDef typesDef) throws AtlasServiceException {
+        AtlasTypesDef toCreate = new AtlasTypesDef();
         for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
-            try {
-                atlasClientV2.createEnumDef(enumDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("EnumDef creation failed for {}", enumDef.getName());
-            }
-        }
-        for (AtlasStructDef structDef : typesDef.getStructDefs()) {
-            try {
-                atlasClientV2.createStructDef(structDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("StructDef creation failed for {}", structDef.getName());
-            }
-        }
-        
-            AtlasTypesDef entityDefs = new AtlasTypesDef(
-            Collections.<AtlasEnumDef>emptyList(),
-            Collections.<AtlasStructDef>emptyList(),
-            Collections.<AtlasClassificationDef>emptyList(),
-            typesDef.getEntityDefs());
-        try {
-            atlasClientV2.createAtlasTypeDefs(entityDefs);
-        }
-        catch(AtlasServiceException e) {
-            LOG.warn("Type creation failed for {}", typesDef.toString());
-            LOG.warn(e.toString());
-        }
-        
-        for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
-            try {
-                atlasClientV2.createClassificationDef(classificationDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("ClassificationDef creation failed for {}", classificationDef.getName());
+            if (atlasClientV2.typeWithNameExists(enumDef.getName())) {
+                LOG.warn("Type with name {} already exists. Skipping", enumDef.getName());
+            } else {
+                toCreate.getEnumDefs().add(enumDef);
             }
         }
 
-    }
-    
-    protected void createType(AtlasTypesDef typesDef) {
-        // Since the bulk create bails out on a single failure, this has to be done as a workaround
-        for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
-            try {
-                atlasClientV2.createEnumDef(enumDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("EnumDef creation failed for {}", enumDef.getName());
-            }
-        }
         for (AtlasStructDef structDef : typesDef.getStructDefs()) {
-            try {
-                atlasClientV2.createStructDef(structDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("StructDef creation failed for {}", structDef.getName());
+            if (atlasClientV2.typeWithNameExists(structDef.getName())) {
+                LOG.warn("Type with name {} already exists. Skipping", structDef.getName());
+            } else {
+                toCreate.getStructDefs().add(structDef);
             }
         }
+
         for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) {
-            try {
-                atlasClientV2.createEntityDef(entityDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("EntityDef creation failed for {}", entityDef.getName());
-            }
-        }
-        for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
-            try {
-                atlasClientV2.createClassificationDef(classificationDef);
-            } catch (AtlasServiceException ex) {
-                LOG.warn("ClassificationDef creation failed for {}", classificationDef.getName());
+            if (atlasClientV2.typeWithNameExists(entityDef.getName())) {
+                LOG.warn("Type with name {} already exists. Skipping", entityDef.getName());
+            } else  {
+                toCreate.getEntityDefs().add(entityDef);
             }
         }
 
+        for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
+            if (atlasClientV2.typeWithNameExists(classificationDef.getName())) {
+                LOG.warn("Type with name {} already exists. Skipping", classificationDef.getName());
+            } else  {
+                toCreate.getClassificationDefs().add(classificationDef);
+            }
+        }
+
+        atlasClientV2.createAtlasTypeDefs(toCreate);
     }
 
-    protected void createType(TypesDef typesDef) throws Exception {
-        try{
-            if ( !typesDef.enumTypes().isEmpty() ){
-                String sampleType = typesDef.enumTypesAsJavaList().get(0).name;
-                atlasClientV1.getType(sampleType);
-                LOG.info("Checking enum type existence");
+    protected void createType(AtlasTypesDef typesDef) throws AtlasServiceException {
+        // Since the bulk create bails out on a single failure, this has to be done as a workaround
+        batchCreateTypes(typesDef);
+    }
+
+    protected List<String> createType(TypesDef typesDef) throws Exception {
+        List<EnumTypeDefinition> enumTypes = new ArrayList<>();
+        List<StructTypeDefinition> structTypes = new ArrayList<>();
+        List<HierarchicalTypeDefinition<TraitType>> traitTypes = new ArrayList<>();
+        List<HierarchicalTypeDefinition<ClassType>> classTypes = new ArrayList<>();
+
+        for (EnumTypeDefinition enumTypeDefinition : typesDef.enumTypesAsJavaList()) {
+            if (atlasClientV2.typeWithNameExists(enumTypeDefinition.name)) {
+                LOG.warn("Type with name {} already exists. Skipping", enumTypeDefinition.name);
+            } else {
+                enumTypes.add(enumTypeDefinition);
             }
-            else if( !typesDef.structTypes().isEmpty()){
-                StructTypeDefinition sampleType = typesDef.structTypesAsJavaList().get(0);
-                atlasClientV1.getType(sampleType.typeName);
-                LOG.info("Checking struct type existence");
-            }
-            else if( !typesDef.traitTypes().isEmpty()){
-                HierarchicalTypeDefinition<TraitType> sampleType = typesDef.traitTypesAsJavaList().get(0);
-                atlasClientV1.getType(sampleType.typeName);
-                LOG.info("Checking trait type existence");
-            }
-            else{
-                HierarchicalTypeDefinition<ClassType> sampleType = typesDef.classTypesAsJavaList().get(0);
-                atlasClientV1.getType(sampleType.typeName);
-                LOG.info("Checking class type existence");
-            }
-            LOG.info("Types already exist. Skipping type creation");
-        } catch(AtlasServiceException ase) {
-            //Expected if type doesn't exist
-            String typesAsJSON = TypesSerialization.toJson(typesDef);
-            createType(typesAsJSON);
         }
+        for (StructTypeDefinition structTypeDefinition : typesDef.structTypesAsJavaList()) {
+            if (atlasClientV2.typeWithNameExists(structTypeDefinition.typeName)) {
+                LOG.warn("Type with name {} already exists. Skipping", structTypeDefinition.typeName);
+            } else {
+                structTypes.add(structTypeDefinition);
+            }
+        }
+        for (HierarchicalTypeDefinition<TraitType> hierarchicalTypeDefinition : typesDef.traitTypesAsJavaList()) {
+            if (atlasClientV2.typeWithNameExists(hierarchicalTypeDefinition.typeName)) {
+                LOG.warn("Type with name {} already exists. Skipping", hierarchicalTypeDefinition.typeName);
+            } else {
+                traitTypes.add(hierarchicalTypeDefinition);
+            }
+        }
+        for (HierarchicalTypeDefinition<ClassType> hierarchicalTypeDefinition : typesDef.classTypesAsJavaList()) {
+            if (atlasClientV2.typeWithNameExists(hierarchicalTypeDefinition.typeName)) {
+                LOG.warn("Type with name {} already exists. Skipping", hierarchicalTypeDefinition.typeName);
+            } else {
+                classTypes.add(hierarchicalTypeDefinition);
+            }
+        }
+
+        TypesDef toCreate = TypesUtil.getTypesDef(ImmutableList.copyOf(enumTypes),
+                ImmutableList.copyOf(structTypes),
+                ImmutableList.copyOf(traitTypes),
+                ImmutableList.copyOf(classTypes));
+        return atlasClientV1.createType(toCreate);
     }
 
     protected List<String> createType(String typesAsJSON) throws Exception {
-        return atlasClientV1.createType(TypesSerialization.fromJson(typesAsJSON));
+        return createType(TypesSerialization.fromJson(typesAsJSON));
     }
 
     protected Id createInstance(Referenceable referenceable) throws Exception {
         String typeName = referenceable.getTypeName();
         System.out.println("creating instance of type " + typeName);
 
-        String entityJSON = InstanceSerialization.toJson(referenceable, true);
-        System.out.println("Submitting new entity= " + entityJSON);
-        List<String> guids = atlasClientV1.createEntity(entityJSON);
+        List<String> guids = atlasClientV1.createEntity(referenceable);
         System.out.println("created instance for type " + typeName + ", guid: " + guids);
 
         // return the reference to created instance with guid
@@ -314,7 +294,7 @@
                         attrDef("owner", DataTypes.STRING_TYPE), attrDef("createTime", DataTypes.INT_TYPE),
                         new AttributeDefinition("tables", DataTypes.arrayTypeName(HIVE_TABLE_TYPE),
                                 Multiplicity.OPTIONAL, false, "db")
-                        );
+                );
 
         HierarchicalTypeDefinition<ClassType> columnClsDef = TypesUtil
                 .createClassTypeDef(COLUMN_TYPE, null, attrDef(NAME, DataTypes.STRING_TYPE),
@@ -364,26 +344,23 @@
                 TypesUtil.createTraitTypeDef("sec", ImmutableSet.<String>of());
         HierarchicalTypeDefinition<TraitType> financeTrait =
                 TypesUtil.createTraitTypeDef("finance", ImmutableSet.<String>of());
-        /*HierarchicalTypeDefinition<TraitType> factTrait =
+        HierarchicalTypeDefinition<TraitType> factTrait =
                 TypesUtil.createTraitTypeDef("Fact", ImmutableSet.<String>of());
         HierarchicalTypeDefinition<TraitType> etlTrait =
                 TypesUtil.createTraitTypeDef("ETL", ImmutableSet.<String>of());
         HierarchicalTypeDefinition<TraitType> dimensionTrait =
                 TypesUtil.createTraitTypeDef("Dimension", ImmutableSet.<String>of());
         HierarchicalTypeDefinition<TraitType> metricTrait =
-                TypesUtil.createTraitTypeDef("Metric", ImmutableSet.<String>of());*/
+                TypesUtil.createTraitTypeDef("Metric", ImmutableSet.<String>of());
 
-        createType(getTypesDef(ImmutableList.of(enumTypeDefinition), null, null, null));
-        createType(getTypesDef(null, ImmutableList.of(structTypeDefinition), null, null));
-        createType(getTypesDef(null, null,
-                 ImmutableList.of(classificationTrait, piiTrait, phiTrait, pciTrait,
-                         soxTrait, secTrait, financeTrait), null));
-        createType(getTypesDef(null, null, null,
+        createType(getTypesDef(ImmutableList.of(enumTypeDefinition), ImmutableList.of(structTypeDefinition),
+                ImmutableList.of(classificationTrait, piiTrait, phiTrait, pciTrait,
+                        soxTrait, secTrait, financeTrait, factTrait, etlTrait, dimensionTrait, metricTrait),
                 ImmutableList.of(dbClsDef, columnClsDef, tblClsDef, loadProcessClsDef)));
     }
 
     protected void createTypeDefinitionsV2() throws Exception {
-        
+
         AtlasConstraintDef isCompositeSourceConstraint = new AtlasConstraintDef(CONSTRAINT_TYPE_OWNED_REF);
 
         AtlasConstraintDef isCompositeTargetConstraint = new AtlasConstraintDef(CONSTRAINT_TYPE_INVERSE_REF,
@@ -397,9 +374,9 @@
                 AtlasTypeUtil.createOptionalAttrDef("locationUri", "string"),
                 AtlasTypeUtil.createOptionalAttrDef("owner", "string"),
                 AtlasTypeUtil.createOptionalAttrDef("createTime", "int"),
-                AtlasTypeUtil.createOptionalAttrDef("createTime", "int"), 
+                AtlasTypeUtil.createOptionalAttrDef("createTime", "int"),
                 //there is a serializ
-                new AtlasAttributeDef("randomTable", 
+                new AtlasAttributeDef("randomTable",
                         DataTypes.arrayTypeName(HIVE_TABLE_TYPE_V2),
                         true,
                         Cardinality.SET,
@@ -429,12 +406,12 @@
                         AtlasTypeUtil.createOptionalAttrDef("createTime", "long"),
                         AtlasTypeUtil.createOptionalAttrDef("lastAccessTime", "date"),
                         AtlasTypeUtil.createOptionalAttrDef("temporary", "boolean"),
-                        new AtlasAttributeDef("db", 
+                        new AtlasAttributeDef("db",
                                 DATABASE_TYPE_V2,
                                 true,
                                 Cardinality.SINGLE,
                                 0, 1, false, true, Collections.singletonList(isCompositeTargetConstraint)),
-                        
+
                         //some tests don't set the columns field or set it to null...
                         AtlasTypeUtil.createOptionalAttrDef("columns", DataTypes.arrayTypeName(COLUMN_TYPE_V2)),
                         AtlasTypeUtil.createOptionalAttrDef("tableType", "tableType"),
@@ -591,6 +568,7 @@
         Referenceable databaseInstance = new Referenceable(DATABASE_TYPE);
         databaseInstance.set(NAME, dbName);
         databaseInstance.set(DESCRIPTION, "foo database");
+        databaseInstance.set(CLUSTER_NAME, "fooCluster");
         return databaseInstance;
     }
 
@@ -598,6 +576,7 @@
         AtlasEntity atlasEntity = new AtlasEntity(DATABASE_TYPE_V2);
         atlasEntity.setAttribute(NAME, dbName);
         atlasEntity.setAttribute(DESCRIPTION, "foo database");
+        atlasEntity.setAttribute(CLUSTER_NAME, "fooCluster");
         atlasEntity.setAttribute("owner", "user1");
         atlasEntity.setAttribute("locationUri", "/tmp");
         atlasEntity.setAttribute("createTime",1000);
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
similarity index 99%
rename from webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
index ee4057d..8c6ba77 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
@@ -16,24 +16,24 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.atlas.typesystem.persistence.Id;
+import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
+import org.apache.atlas.typesystem.types.TraitType;
+import org.apache.atlas.typesystem.types.utils.TypesUtil;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import com.google.common.collect.ImmutableSet;
 
 import java.util.List;
 import java.util.Map;
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityDiscoveryJerseyResourceIT.java
new file mode 100755
index 0000000..157bf97
--- /dev/null
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityDiscoveryJerseyResourceIT.java
@@ -0,0 +1,211 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.atlas.web.integration;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.discovery.AtlasSearchResult;
+import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult;
+import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasQueryType;
+import org.apache.atlas.model.instance.AtlasEntity.Status;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.typesystem.TypesDef;
+import org.apache.atlas.typesystem.types.ClassType;
+import org.apache.atlas.typesystem.types.DataTypes;
+import org.apache.atlas.typesystem.types.EnumTypeDefinition;
+import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
+import org.apache.atlas.typesystem.types.StructTypeDefinition;
+import org.apache.atlas.typesystem.types.TraitType;
+import org.apache.atlas.typesystem.types.utils.TypesUtil;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
+/**
+ * Search V2 Integration Tests.
+ */
+public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
+    private String dbName;
+
+    @BeforeClass
+    public void setUp() throws Exception {
+        super.setUp();
+        dbName = "db" + randomString();
+        createTypes();
+        createInstance(createHiveDBInstanceBuiltIn(dbName));
+    }
+
+    @Test
+    public void testSearchByDSL() throws Exception {
+        String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
+
+        AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
+        assertNotNull(searchResult);
+        assertEquals(searchResult.getQueryText(), dslQuery);
+        assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
+
+        List<AtlasEntityHeader> entities = searchResult.getEntities();
+        assertNotNull(entities);
+        assertEquals(entities.size(), 1);
+
+        AtlasEntityHeader dbEntity = entities.get(0);
+        assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
+        assertEquals(dbEntity.getDisplayText(), dbName);
+        assertEquals(dbEntity.getStatus(), Status.ACTIVE);
+        assertNotNull(dbEntity.getGuid());
+        assertNull(searchResult.getAttributes());
+        assertNull(searchResult.getFullTextResult());
+    }
+
+    @Test
+    public void testSearchDSLLimits() throws Exception {
+        String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
+        AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
+        assertNotNull(searchResult);
+
+        //higher limit, all results returned
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 0);
+        assertEquals(searchResult.getEntities().size(), 1);
+
+        //default limit and offset -1, all results returned
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, -1, -1);
+        assertEquals(searchResult.getEntities().size(), 1);
+
+        //uses the limit parameter passed
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 1, 0);
+        assertEquals(searchResult.getEntities().size(), 1);
+
+        //uses the offset parameter passed
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 1);
+        assertNull(searchResult.getEntities());
+
+        //limit > 0
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 0, 10);
+        assertNull(searchResult.getEntities());
+
+        //limit > maxlimit
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, Integer.MAX_VALUE, 10);
+        assertNull(searchResult.getEntities());
+
+        //offset >= 0
+        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, -2);
+        assertEquals(searchResult.getEntities().size(), 1);
+    }
+
+    @Test(expectedExceptions = AtlasServiceException.class)
+    public void testSearchByDSLForUnknownType() throws Exception {
+        String dslQuery = "from blah";
+        atlasClientV2.dslSearch(dslQuery);
+    }
+
+    @Test
+    public void testSearchUsingDSL() throws Exception {
+        String query = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
+        AtlasSearchResult searchResult = atlasClientV2.dslSearch(query);
+        assertNotNull(searchResult);
+
+        assertEquals(searchResult.getQueryText(), query);
+        assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
+        List<AtlasEntityHeader> entities = searchResult.getEntities();
+        assertNotNull(entities);
+        assertEquals(entities.size(), 1);
+
+        AtlasEntityHeader dbEntity = entities.get(0);
+        assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
+        assertEquals(dbEntity.getDisplayText(), dbName);
+        assertEquals(dbEntity.getStatus(), Status.ACTIVE);
+
+        assertNotNull(dbEntity.getGuid());
+        assertNull(searchResult.getAttributes());
+        assertNull(searchResult.getFullTextResult());
+    }
+
+    @Test
+    public void testSearchFullTextOnDSLFailure() throws Exception {
+        String query = "*";
+        AtlasSearchResult searchResult = atlasClientV2.fullTextSearch(query);
+        assertNotNull(searchResult);
+        assertEquals(searchResult.getQueryText(), query);
+        assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT);
+    }
+
+    @Test(dependsOnMethods = "testSearchDSLLimits")
+    public void testSearchUsingFullText() throws Exception {
+        AtlasSearchResult searchResult = atlasClientV2.fullTextSearchWithParams(dbName, 10, 0);
+        assertNotNull(searchResult);
+
+        assertEquals(searchResult.getQueryText(), dbName);
+        assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT);
+
+        List<AtlasFullTextResult> fullTextResults = searchResult.getFullTextResult();
+        assertEquals(fullTextResults.size(), 1);
+
+        AtlasFullTextResult result = fullTextResults.get(0);
+        assertNotNull(result.getEntity());
+        assertEquals(result.getEntity().getTypeName(), DATABASE_TYPE_BUILTIN);
+        assertNotNull(result.getScore());
+
+        //API works without limit and offset
+        String query = dbName;
+        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
+        queryParams.add("query", query);
+        searchResult = atlasClientV2.fullTextSearch(query);
+        assertNotNull(searchResult);
+        assertEquals(searchResult.getFullTextResult().size(), 1);
+
+        //verify passed in limits and offsets are used
+        //higher limit and 0 offset returns all results
+        searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 0);
+        assertEquals(searchResult.getFullTextResult().size(), 1);
+
+        //offset is used
+        searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 1);
+        assertEquals(searchResult.getFullTextResult().size(), 1);
+
+        //limit is used
+        searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 0);
+        assertEquals(searchResult.getFullTextResult().size(), 1);
+
+        //higher offset returns 0 results
+        searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 2);
+        assertEquals(searchResult.getFullTextResult().size(), 1);
+    }
+
+    private void createTypes() throws Exception {
+        HierarchicalTypeDefinition<ClassType> dslTestTypeDefinition = TypesUtil
+                .createClassTypeDef("dsl_test_type", ImmutableSet.<String>of(),
+                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE));
+
+        HierarchicalTypeDefinition<TraitType> classificationTraitDefinition = TypesUtil
+                .createTraitTypeDef("Classification", ImmutableSet.<String>of(),
+                        TypesUtil.createRequiredAttrDef("tag", DataTypes.STRING_TYPE));
+        TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
+                ImmutableList.of(classificationTraitDefinition), ImmutableList.of(dslTestTypeDefinition));
+        createType(typesDef);
+    }
+}
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
similarity index 67%
rename from webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
index f2af208..310b2e3 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
@@ -16,32 +16,20 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.EntityAuditEvent;
-import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.kafka.NotificationProvider;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.notification.NotificationConsumer;
 import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
 import org.apache.atlas.notification.entity.EntityNotification;
-import org.apache.atlas.type.AtlasType;
-import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
@@ -67,36 +55,32 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.gson.Gson;
-import com.google.gson.JsonSyntaxException;
-import com.google.inject.Inject;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
 
 
 /**
  * Integration tests for Entity Jersey Resource.
  */
-@Guice(modules = NotificationModule.class)
 public class EntityJerseyResourceIT extends BaseResourceIT {
 
     private static final Logger LOG = LoggerFactory.getLogger(EntityJerseyResourceIT.class);
 
-    private final String DATABASE_NAME = "db" + randomString();
-    private final String TABLE_NAME = "table" + randomString();
     private static final String TRAITS = "traits";
-    private Referenceable tableInstance;
-    private Id tableId;
-    private Id dbId;
-    private String traitName;
 
-    @Inject
-    private NotificationInterface notificationInterface;
+    private NotificationInterface notificationInterface = NotificationProvider.get();
     private NotificationConsumer<EntityNotification> notificationConsumer;
 
     @BeforeClass
@@ -104,8 +88,6 @@
         super.setUp();
 
         createTypeDefinitionsV1();
-        Referenceable HiveDBInstance = createHiveDBInstanceBuiltIn(DATABASE_NAME);
-        dbId = createInstance(HiveDBInstance);
 
         List<NotificationConsumer<EntityNotification>> consumers =
                 notificationInterface.createConsumers(NotificationInterface.NotificationType.ENTITIES, 1);
@@ -150,35 +132,22 @@
 
         //Create the tables.  The database and columns should be created automatically, since
         //the tables reference them.
-        JSONArray entityArray = new JSONArray(tables.size());
-        for(int i = 0; i < tables.size(); i++) {
-            Referenceable table = tables.get(i);
-            entityArray.put(InstanceSerialization.toJson(table, true));
-        }
-        String json = entityArray.toString();
-
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, json);
-
-        GuidMapping guidMapping = AtlasType.fromJson(response.toString(), GuidMapping.class);
-
-        Map<String,String> guidsCreated = guidMapping.getGuidAssignments();
-        assertEquals(guidsCreated.size(), nTables * colsPerTable + nTables + 1);
-        assertNotNull(guidsCreated.get(databaseInstance.getId()._getId()));
-        for(Referenceable r : allColumns) {
-            assertNotNull(guidsCreated.get(r.getId()._getId()));
-        }
-        for(Referenceable r : tables) {
-            assertNotNull(guidsCreated.get(r.getId()._getId()));
-        }
+        List<String> entityGUIDs = atlasClientV1.createEntity(tables);
+        assertNotNull(entityGUIDs);
+        assertEquals(entityGUIDs.size(), nTables * (colsPerTable + 1) + 1);
     }
 
 
     @Test
     public void testSubmitEntity() throws Exception {
-        tableInstance = createHiveTableInstanceBuiltIn(DATABASE_NAME, TABLE_NAME, dbId);
-        tableId = createInstance(tableInstance);
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable referenceable = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(referenceable);
 
-        final String guid = tableId._getId();
+        final String guid = id._getId();
         try {
             Assert.assertNotNull(UUID.fromString(guid));
         } catch (IllegalArgumentException e) {
@@ -235,14 +204,13 @@
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
-        AtlasClient.EntityResult entityResult = AtlasClient.EntityResult.fromString(response.toString());
+        EntityResult entityResult = EntityResult.fromString(response.toString());
         assertEquals(entityResult.getCreatedEntities().size(), 1);
         assertNotNull(entityResult.getCreatedEntities().get(0));
     }
 
     @Test
     public void testEntityDeduping() throws Exception {
-        final Referenceable db = new Referenceable(DATABASE_TYPE_BUILTIN);
         final String dbName = "db" + randomString();
         Referenceable HiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
         Id dbIdReference = createInstance(HiveDBInstance);
@@ -280,7 +248,7 @@
         //Test the same across references
         Referenceable table = new Referenceable(HIVE_TABLE_TYPE_BUILTIN);
         final String tableName = randomString();
-        Referenceable tableInstance = createHiveTableInstanceBuiltIn(DATABASE_NAME, tableName, dbIdReference);
+        Referenceable tableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbIdReference);
         atlasClientV1.createEntity(tableInstance);
         results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE_BUILTIN, dbName));
         assertEquals(results.length(), 1);
@@ -366,9 +334,13 @@
     @Test
     public void testSubmitEntityWithBadDateFormat() throws Exception {
         try {
-            Referenceable tableInstance = createHiveTableInstanceBuiltIn("db" + randomString(), "table" + randomString(), dbId);
-            tableInstance.set("lastAccessTime", "2014-07-11");
-            tableId = createInstance(tableInstance);
+            String dbName = "db" + randomString();
+            String tableName = "table" + randomString();
+            Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+            Id dbId = createInstance(hiveDBInstance);
+            Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+            hiveTableInstance.set("lastAccessTime", "2014-07-11");
+            Id tableId = createInstance(hiveTableInstance);
             Assert.fail("Was expecting an  exception here ");
         } catch (AtlasServiceException e) {
             Assert.assertTrue(
@@ -376,9 +348,21 @@
         }
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testAddProperty() throws Exception {
-        final String guid = tableId._getId();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable referenceable = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(referenceable);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
         //add property
         String description = "bar table - new desc";
         addProperty(guid, "description", description);
@@ -386,7 +370,7 @@
         JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
         Assert.assertNotNull(response);
 
-        tableInstance.set("description", description);
+        referenceable.set("description", description);
 
         //invalid property for the type
         try {
@@ -404,12 +388,25 @@
         response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
         Assert.assertNotNull(response);
 
-        tableInstance.set("createTime", currentTime);
+        referenceable.set("createTime", currentTime);
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity", expectedExceptions = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testAddNullProperty() throws Exception {
-        final String guid = tableId._getId();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         //add property
         addProperty(guid, null, "foo bar");
         Assert.fail();
@@ -417,7 +414,20 @@
 
     @Test(enabled = false)
     public void testAddNullPropertyValue() throws Exception {
-        final String guid = tableId._getId();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         //add property
         try {
             addProperty(guid, "description", null);
@@ -427,11 +437,25 @@
         }
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testAddReferenceProperty() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         //Create new db instance
+        dbName = "db" + randomString();
         Referenceable databaseInstance = new Referenceable(DATABASE_TYPE_BUILTIN);
-        String dbName = randomString();
         databaseInstance.set(NAME, dbName);
         databaseInstance.set(QUALIFIED_NAME, dbName);
         databaseInstance.set(CLUSTER_NAME, randomString());
@@ -443,29 +467,34 @@
         databaseInstance.set("location", "/tmp");
 
         Id dbInstance = createInstance(databaseInstance);
-        String dbId = dbInstance._getId();
+        String newDBId = dbInstance._getId();
 
         //Add reference property
-        final String guid = tableId._getId();
-        addProperty(guid, "db", dbId);
+        addProperty(guid, "db", newDBId);
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testGetEntityDefinition() throws Exception {
-        final String guid = tableId._getId();
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
 
-        Assert.assertNotNull(response);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
 
-        final String definition = response.getString(AtlasClient.DEFINITION);
-        Assert.assertNotNull(definition);
-        LOG.debug("tableInstanceAfterGet = {}", definition);
-        InstanceSerialization.fromJsonReferenceable(definition, true);
+        Referenceable entity = atlasClientV1.getEntity(guid);
+        Assert.assertNotNull(entity);
     }
 
     private void addProperty(String guid, String property, String value) throws AtlasServiceException {
-        AtlasClient.EntityResult entityResult = atlasClientV1.updateEntityAttribute(guid, property, value);
+        EntityResult entityResult = atlasClientV1.updateEntityAttribute(guid, property, value);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
         assertEquals(entityResult.getUpdateEntities().get(0), guid);
     }
@@ -480,11 +509,25 @@
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testGetEntityList() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         List<String> entities = atlasClientV1.listEntities(HIVE_TABLE_TYPE_BUILTIN);
         Assert.assertNotNull(entities);
-        Assert.assertTrue(entities.contains(tableId._getId()));
+        Assert.assertTrue(entities.contains(guid));
     }
 
     @Test(expectedExceptions = AtlasServiceException.class)
@@ -525,21 +568,44 @@
         return typeName;
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testGetTraitNames() throws Exception {
-        final String guid = tableId._getId();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TRAITS, null, guid, TRAITS);
-        assertNotNull(response);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
 
-        final JSONArray list = response.getJSONArray(AtlasClient.RESULTS);
-        Assert.assertEquals(list.length(), 7);
+        List<String> traits = atlasClientV1.listTraits(guid);
+        assertNotNull(traits);
+        Assert.assertEquals(traits.size(), 7);
     }
 
-    @Test(dependsOnMethods = "testGetTraitNames")
+    @Test
     public void testAddTrait() throws Exception {
-        traitName = "PII_Trait" + randomString();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
+        String traitName = "PII_Trait" + randomString();
         HierarchicalTypeDefinition<TraitType> piiTrait =
                 TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
@@ -547,20 +613,28 @@
         createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
-        String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
-        final String guid = tableId._getId();
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
-        assertNotNull(response);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
-
+        atlasClientV1.addTrait(guid, traitInstance);
         assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_ADD);
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testgetTraitDefinitionForEntity() throws Exception{
-        traitName = "PII_Trait" + randomString();
+    @Test
+    public void testGetTraitDefinitionForEntity() throws Exception{
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
+        String traitName = "PII_Trait" + randomString();
         HierarchicalTypeDefinition<TraitType> piiTrait =
                 TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
         String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
@@ -568,38 +642,66 @@
         createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
-        String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
-
-        final String guid = tableId._getId();
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
-        assertNotNull(response);
+        atlasClientV1.addTrait(guid, traitInstance);
         Struct traitDef = atlasClientV1.getTraitDefinition(guid, traitName);
-        System.out.println(traitDef.toString());
-        JSONObject responseAsJSON = new JSONObject(InstanceSerialization.toJson(traitDef, true));
-        Assert.assertEquals(responseAsJSON.get("typeName"), traitName);
+        Assert.assertEquals(traitDef.getTypeName(), traitName);
 
 
         List<Struct> allTraitDefs = atlasClientV1.listTraitDefinitions(guid);
         System.out.println(allTraitDefs.toString());
-        Assert.assertEquals(allTraitDefs.size(), 9);
+        Assert.assertEquals(allTraitDefs.size(), 8);
     }
 
-    @Test(dependsOnMethods = "testAddTrait", expectedExceptions = AtlasServiceException.class)
+    @Test
     public void testAddExistingTrait() throws Exception {
-        final String traitName = "PII_Trait" + randomString();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
+        String traitName = "PII_Trait" + randomString();
+        HierarchicalTypeDefinition<TraitType> piiTrait =
+                TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
+        String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
+        createType(traitDefinitionAsJSON);
 
         Struct traitInstance = new Struct(traitName);
-        String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
+        atlasClientV1.addTrait(guid, traitInstance);
 
-        final String guid = tableId._getId();
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
-        assertNotNull(response);
+        try {
+            atlasClientV1.addTrait(guid, traitInstance);
+            fail("Duplicate trait addition should've failed");
+        } catch (AtlasServiceException e) {
+            assertEquals(e.getStatus(), ClientResponse.Status.BAD_REQUEST);
+        }
     }
 
-    @Test(dependsOnMethods = "testGetTraitNames")
+    @Test
     public void testAddTraitWithAttribute() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
+
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         final String traitName = "PII_Trait" + randomString();
         HierarchicalTypeDefinition<TraitType> piiTrait = TypesUtil
                 .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
@@ -610,24 +712,15 @@
 
         Struct traitInstance = new Struct(traitName);
         traitInstance.set("type", "SSN");
-        String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
-
-        final String guid = tableId._getId();
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
-        assertNotNull(response);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        atlasClientV1.addTrait(guid, traitInstance);
 
         // verify the response
-        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        Referenceable entity = atlasClientV1.getEntity(guid);
+        Assert.assertNotNull(entity);
+        Assert.assertEquals(entity.getId()._getId(), guid);
 
-        final String definition = response.getString(AtlasClient.DEFINITION);
-        Assert.assertNotNull(definition);
-        Referenceable entityRef = InstanceSerialization.fromJsonReferenceable(definition, true);
-        IStruct traitRef = entityRef.getTrait(traitName);
-        String type = (String) traitRef.get("type");
-        Assert.assertEquals(type, "SSN");
+        assertNotNull(entity.getTrait(traitName));
+        assertEquals(entity.getTrait(traitName).get("type"), traitInstance.get("type"));
     }
 
     @Test(expectedExceptions = AtlasServiceException.class)
@@ -642,33 +735,85 @@
         String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance, true);
         LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS);
+        atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS);
     }
 
-    @Test(dependsOnMethods = "testAddTrait")
+    @Test
     public void testDeleteTrait() throws Exception {
-        final String guid = tableId._getId();
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
-        Assert.assertNotNull(response.get("traitName"));
-        assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_DELETE);
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
+        String traitName = "PII_Trait" + randomString();
+        HierarchicalTypeDefinition<TraitType> piiTrait =
+                TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
+        String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
+        LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
+        createType(traitDefinitionAsJSON);
+
+        Struct traitInstance = new Struct(traitName);
+
+        atlasClientV1.addTrait(guid, traitInstance);
+        assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_ADD);
+
+        atlasClientV1.deleteTrait(guid, traitName);
+
+        try {
+            atlasClientV1.getTraitDefinition(guid, traitName);
+            fail("Deleted trait definition shouldn't exist");
+        } catch (AtlasServiceException e) {
+            assertEquals(e.getStatus(), ClientResponse.Status.NOT_FOUND);
+            assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_DELETE);
+        }
     }
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testDeleteTraitNonExistent() throws Exception {
-        final String traitName = "blah_trait";
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, "random", TRAITS);
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
 
-        Assert.assertNotNull(response.get(AtlasClient.ERROR));
-        Assert.assertEquals(response.getString(AtlasClient.ERROR),
-                "trait=" + traitName + " should be defined in type system before it can be deleted");
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
+        final String traitName = "blah_trait";
+        atlasClientV1.deleteTrait(guid, traitName);
+        fail("trait=" + traitName + " should be defined in type system before it can be deleted");
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testDeleteExistentTraitNonExistentForEntity() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id id = createInstance(hiveTableInstance);
 
-        final String guid = tableId._getId();
+        final String guid = id._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         final String traitName = "PII_Trait" + randomString();
         HierarchicalTypeDefinition<TraitType> piiTrait = TypesUtil
                 .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
@@ -677,7 +822,7 @@
         createType(traitDefinitionAsJSON);
 
         try {
-            JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
+            atlasClientV1.deleteTrait(guid, traitName);
             fail("Call should've failed for deletion of invalid trait");
         } catch (AtlasServiceException e) {
             assertNotNull(e);
@@ -715,8 +860,22 @@
     }
 
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testPartialUpdate() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id tableId = createInstance(hiveTableInstance);
+
+        final String guid = tableId._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         String colName = "col1"+randomString();
         final List<Referenceable> columns = new ArrayList<>();
         Map<String, Object> values = new HashMap<>();
@@ -728,7 +887,7 @@
         values.put("owner", "user1");
         values.put("position", 0);
         values.put("description", "col1");
-        values.put("table", tableId ); //table is a required reference, can't be null
+        values.put("table", tableId); //table is a required reference, can't be null
 
         Referenceable ref = new Referenceable(BaseResourceIT.COLUMN_TYPE_BUILTIN, values);
         columns.add(ref);
@@ -737,13 +896,12 @@
         }});
 
         LOG.debug("Updating entity= {}", tableUpdated);
-        AtlasClient.EntityResult entityResult = atlasClientV1.updateEntity(tableId._getId(), tableUpdated);
+        EntityResult entityResult = atlasClientV1.updateEntity(guid, tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
-        assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
+        assertEquals(entityResult.getUpdateEntities().get(0), guid);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
-        Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
-        List<Referenceable> refs = (List<Referenceable>) getReferenceable.get("columns");
+        Referenceable entity = atlasClientV1.getEntity(guid);
+        List<Referenceable> refs = (List<Referenceable>) entity.get("columns");
 
         Assert.assertTrue(refs.get(0).equalsContents(columns.get(0)));
 
@@ -757,20 +915,33 @@
 
         LOG.debug("Updating entity= {}", tableUpdated);
         entityResult = atlasClientV1.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE_BUILTIN, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
-                (String) tableInstance.get(QUALIFIED_NAME), tableUpdated);
+                (String) hiveTableInstance.get(QUALIFIED_NAME), tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 2);
-        assertEquals(entityResult.getUpdateEntities().get(1), tableId._getId());
+        assertEquals(entityResult.getUpdateEntities().get(1), guid);
 
-        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
-        getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
-        refs = (List<Referenceable>) getReferenceable.get("columns");
+        entity = atlasClientV1.getEntity(guid);
+        refs = (List<Referenceable>) entity.get("columns");
 
         Assert.assertTrue(refs.get(0).getValuesMap().equals(values));
         Assert.assertEquals(refs.get(0).get("type"), "int");
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
+    @Test
     public void testCompleteUpdate() throws Exception {
+        String dbName = "db" + randomString();
+        String tableName = "table" + randomString();
+        Referenceable hiveDBInstance = createHiveDBInstanceBuiltIn(dbName);
+        Id dbId = createInstance(hiveDBInstance);
+        Referenceable hiveTableInstance = createHiveTableInstanceBuiltIn(dbName, tableName, dbId);
+        Id tableId = createInstance(hiveTableInstance);
+
+        final String guid = tableId._getId();
+        try {
+            Assert.assertNotNull(UUID.fromString(guid));
+        } catch (IllegalArgumentException e) {
+            Assert.fail("Response is not a guid, " + guid);
+        }
+
         final List<Referenceable> columns = new ArrayList<>();
         Map<String, Object> values1 = new HashMap<>();
         values1.put(NAME, "col3");
@@ -797,44 +968,21 @@
         Referenceable ref2 = new Referenceable(BaseResourceIT.COLUMN_TYPE_BUILTIN, values2);
         columns.add(ref1);
         columns.add(ref2);
-        tableInstance.set("columns", columns);
-        String entityJson = InstanceSerialization.toJson(tableInstance, true);
-        JSONArray entityArray = new JSONArray(1);
-        entityArray.put(entityJson);
-        LOG.debug("Replacing entity= {}", tableInstance);
+        hiveTableInstance.set("columns", columns);
+        LOG.debug("Replacing entity= {}", hiveTableInstance);
 
-        JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY, entityArray);
+        EntityResult updateEntity = atlasClientV1.updateEntities(hiveTableInstance);
 
-        // ATLAS-586: verify response entity can be parsed by GSON.
-        Gson gson = new Gson();
-        try {
-            UpdateEntitiesResponse updateEntitiesResponse = gson.fromJson(response.toString(), UpdateEntitiesResponse.class);
-        }
-        catch (JsonSyntaxException e) {
-            Assert.fail("Response entity from not parse-able by GSON", e);
-        }
+        assertNotNull(updateEntity.getUpdateEntities());
 
-        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
-        LOG.info("Response = {}", response.toString());
-        Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
-        List<Referenceable> refs = (List<Referenceable>) getReferenceable.get("columns");
+        hiveTableInstance = atlasClientV1.getEntity(guid);
+        List<Referenceable> refs = (List<Referenceable>) hiveTableInstance.get("columns");
         Assert.assertEquals(refs.size(), 2);
 
         Assert.assertTrue(refs.get(0).getValuesMap().equals(values1));
         Assert.assertTrue(refs.get(1).getValuesMap().equals(values2));
     }
 
-    private static class UpdateEntitiesResponse {
-        String requestId;
-        AtlasClient.EntityResult entities;
-        AtlasEntity definition;
-    }
-
-    private static class AtlasEntity {
-        String typeName;
-        final Map<String, Object> values = new HashMap<>();
-    }
-
     @Test
     public void testDeleteEntitiesViaRestApi() throws Exception {
         // Create 2 database entities
@@ -868,7 +1016,7 @@
         queryParams.add(AtlasClient.GUID.toLowerCase(), db2Id._getId());
 
         JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES, queryParams);
-        List<String> deletedGuidsList = AtlasClient.EntityResult.fromString(response.toString()).getDeletedEntities();
+        List<String> deletedGuidsList = EntityResult.fromString(response.toString()).getDeletedEntities();
         Assert.assertTrue(deletedGuidsList.contains(db1Id._getId()));
         Assert.assertTrue(deletedGuidsList.contains(db2Id._getId()));
 
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
similarity index 99%
rename from webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
index 4f8badf..55c56c2 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.collect.ImmutableList;
 import com.google.gson.Gson;
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java
similarity index 98%
rename from webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java
index 9d5ff5a..98a7abc 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityV2JerseyResourceIT.java
@@ -16,29 +16,22 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.sun.jersey.api.client.ClientResponse;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.model.instance.AtlasClassification;
-import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
-import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
@@ -46,7 +39,6 @@
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.notification.NotificationConsumer;
 import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
 import org.apache.atlas.notification.entity.EntityNotification;
 import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.atlas.typesystem.types.TypeUtils;
@@ -57,20 +49,19 @@
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.sun.jersey.api.client.ClientResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.*;
 
 
 /**
  * Integration tests for Entity Jersey Resource.
  */
-@Guice(modules = {NotificationModule.class})
 public class EntityV2JerseyResourceIT extends BaseResourceIT {
 
     private static final Logger LOG = LoggerFactory.getLogger(EntityV2JerseyResourceIT.class);
@@ -81,8 +72,7 @@
 
     private AtlasEntity dbEntity;
     private AtlasEntity tableEntity;
-    @Inject
-    private NotificationInterface notificationInterface;
+    private NotificationInterface notificationInterface = NotificationProvider.get();
     private NotificationConsumer<EntityNotification> notificationConsumer;
 
     @BeforeClass
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
similarity index 99%
rename from webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
index 87d8719..3fa85b1 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TypedefsJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java
similarity index 92%
rename from webapp/src/test/java/org/apache/atlas/web/resources/TypedefsJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java
index a6a0568..c46689c 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TypedefsJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.collect.ImmutableSet;
 import com.sun.jersey.core.util.MultivaluedMapImpl;
@@ -37,7 +37,6 @@
 import org.apache.atlas.utils.AuthenticationUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -48,7 +47,10 @@
 
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
 import static org.apache.atlas.type.AtlasTypeUtil.createClassTypeDef;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
 /**
  * Integration test for types jersey resource.
@@ -63,7 +65,7 @@
     public void setUp() throws Exception {
         super.setUp();
 
-        typeDefinitions = createHiveTypes();
+        typeDefinitions = createHiveTypesV2();
 
         if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) {
             clientV2 = new AtlasClientV2(atlasUrls, new String[]{"admin", "admin"});
@@ -79,9 +81,25 @@
 
     @Test
     public void testCreate() throws Exception {
-        AtlasTypesDef atlasTypeDefs = clientV2.createAtlasTypeDefs(typeDefinitions);
-        Assert.assertNotNull(atlasTypeDefs);
-        assertFalse(atlasTypeDefs.isEmpty());
+        createType(typeDefinitions);
+
+        for (AtlasEnumDef enumDef : typeDefinitions.getEnumDefs()) {
+            AtlasEnumDef byName = atlasClientV2.getEnumDefByName(enumDef.getName());
+            assertNotNull(byName);
+        }
+        for (AtlasStructDef structDef : typeDefinitions.getStructDefs()) {
+            AtlasStructDef byName = atlasClientV2.getStructDefByName(structDef.getName());
+            assertNotNull(byName);
+        }
+        for (AtlasClassificationDef classificationDef : typeDefinitions.getClassificationDefs()) {
+            AtlasClassificationDef byName = atlasClientV2.getClassificationDefByName(classificationDef.getName());
+            assertNotNull(byName);
+        }
+        for (AtlasEntityDef entityDef : typeDefinitions.getEntityDefs()) {
+            AtlasEntityDef byName = atlasClientV2.getEntityDefByName(entityDef.getName());
+            assertNotNull(byName);
+        }
+
     }
 
     @Test
@@ -275,7 +293,7 @@
         assertEquals(searchDefs.getEntityDefs().size(), 1);
     }
 
-    private AtlasTypesDef createHiveTypes() throws Exception {
+    private AtlasTypesDef createHiveTypesV2() throws Exception {
         AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
 
         AtlasEntityDef databaseTypeDefinition =
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
similarity index 99%
rename from webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
rename to webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
index 2ef33c3..ded3e05 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.atlas.web.resources;
+package org.apache.atlas.web.integration;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
diff --git a/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java b/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
deleted file mode 100644
index da221fc..0000000
--- a/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.web.listeners;
-
-import javax.servlet.ServletContextEvent;
-
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.commons.configuration.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Module;
-
-public class TestGuiceServletConfig extends GuiceServletConfig {
-
-    private static final Logger LOG = LoggerFactory.getLogger(TestGuiceServletConfig.class);
-    private boolean servicesEnabled;
-
-    @Override
-    public void contextInitialized(ServletContextEvent servletContextEvent) {
-        LOG.info("Initializing test servlet listener");
-        super.contextInitialized(servletContextEvent);
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent servletContextEvent) {
-        super.contextDestroyed(servletContextEvent);
-
-        if(injector != null) {
-            AtlasGraph graph = AtlasGraphProvider.getGraphInstance();
-
-            LOG.info("Clearing graph store");
-            try {
-                AtlasGraphProvider.cleanup();
-            } catch (Exception e) {
-                LOG.warn("Clearing graph store failed ", e);
-            }
-        }
-    }
-
-    @Override
-    protected Module getRepositoryModule() {
-        return new TestModule();
-    }
-
-    @Override
-    protected void startServices() {
-        try {
-            Configuration conf = ApplicationProperties.get();
-            servicesEnabled = conf.getBoolean("atlas.services.enabled", true);
-            if (servicesEnabled) {
-                super.startServices();
-            }
-        } catch (AtlasException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    protected void stopServices() {
-        if (servicesEnabled) {
-            super.stopServices();
-        }
-    }
-}
diff --git a/webapp/src/test/java/org/apache/atlas/web/listeners/TestModule.java b/webapp/src/test/java/org/apache/atlas/web/listeners/TestModule.java
deleted file mode 100644
index b00080f..0000000
--- a/webapp/src/test/java/org/apache/atlas/web/listeners/TestModule.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.listeners;
-
-import com.google.inject.Binder;
-
-import org.apache.atlas.RepositoryMetadataModule;
-import org.apache.atlas.repository.audit.EntityAuditRepository;
-import org.apache.atlas.repository.audit.InMemoryEntityAuditRepository;
-import org.apache.commons.configuration.Configuration;
-
-public class TestModule extends RepositoryMetadataModule {
-    @Override
-    protected void bindAuditRepository(Binder binder, Configuration configuration) {
-        //Map EntityAuditRepository interface to hbase based implementation
-        binder.bind(EntityAuditRepository.class).to(InMemoryEntityAuditRepository.class).asEagerSingleton();
-    }
-}
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java b/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java
index c0bbf09..1fe3119 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java
@@ -48,7 +48,7 @@
 
         when(serviceState.getState()).thenReturn(ServiceState.ServiceStateValue.ACTIVE);
 
-        AdminResource adminResource = new AdminResource(serviceState, null, null, null, null);
+        AdminResource adminResource = new AdminResource(serviceState, null, null, null, null, null);
         Response response = adminResource.getStatus();
         assertEquals(response.getStatus(), HttpServletResponse.SC_OK);
         JSONObject entity = (JSONObject) response.getEntity();
@@ -59,7 +59,7 @@
     public void testResourceGetsValueFromServiceState() throws JSONException {
         when(serviceState.getState()).thenReturn(ServiceState.ServiceStateValue.PASSIVE);
 
-        AdminResource adminResource = new AdminResource(serviceState, null, null, null, null);
+        AdminResource adminResource = new AdminResource(serviceState, null, null, null, null, null);
         Response response = adminResource.getStatus();
 
         verify(serviceState).getState();
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
index a51f371..e69de29 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
@@ -1,227 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.web.resources;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-import org.apache.atlas.AtlasServiceException;
-import org.apache.atlas.model.discovery.AtlasSearchResult;
-import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult;
-import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasQueryType;
-import org.apache.atlas.model.instance.AtlasEntity.Status;
-import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import javax.ws.rs.core.MultivaluedMap;
-import java.util.List;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-/**
- * Search V2 Integration Tests.
- */
-public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
-    private String dbName;
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        super.setUp();
-        dbName = "database" + randomString();
-        createTypes();
-        createInstance(createHiveDBInstanceBuiltIn(dbName));
-    }
-
-    @Test
-    public void testSearchByDSL() throws Exception {
-        String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
-
-        AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
-        assertNotNull(searchResult);
-        assertEquals(searchResult.getQueryText(), dslQuery);
-        assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
-
-        List<AtlasEntityHeader> entities = searchResult.getEntities();
-        assertNotNull(entities);
-        assertEquals(entities.size(), 1);
-
-        AtlasEntityHeader dbEntity = entities.get(0);
-        assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
-        assertEquals(dbEntity.getDisplayText(), dbName);
-        assertEquals(dbEntity.getStatus(), Status.ACTIVE);
-        assertNotNull(dbEntity.getGuid());
-        assertNull(searchResult.getAttributes());
-        assertNull(searchResult.getFullTextResult());
-    }
-
-    @Test
-    public void testSearchDSLLimits() throws Exception {
-        String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
-        AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
-        assertNotNull(searchResult);
-
-        //higher limit, all results returned
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 0);
-        assertEquals(searchResult.getEntities().size(), 1);
-
-        //default limit and offset -1, all results returned
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, -1, -1);
-        assertEquals(searchResult.getEntities().size(), 1);
-
-        //uses the limit parameter passed
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 1, 0);
-        assertEquals(searchResult.getEntities().size(), 1);
-
-        //uses the offset parameter passed
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 1);
-        assertNull(searchResult.getEntities());
-
-        //limit > 0
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 0, 10);
-        assertNull(searchResult.getEntities());
-
-        //limit > maxlimit
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, Integer.MAX_VALUE, 10);
-        assertNull(searchResult.getEntities());
-
-        //offset >= 0
-        searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, -2);
-        assertEquals(searchResult.getEntities().size(), 1);
-    }
-
-    @Test(expectedExceptions = AtlasServiceException.class)
-    public void testSearchByDSLForUnknownType() throws Exception {
-        String dslQuery = "from blah";
-        atlasClientV2.dslSearch(dslQuery);
-    }
-
-    @Test
-    public void testSearchUsingDSL() throws Exception {
-        String query = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
-        AtlasSearchResult searchResult = atlasClientV2.dslSearch(query);
-        assertNotNull(searchResult);
-
-        assertEquals(searchResult.getQueryText(), query);
-        assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
-        List<AtlasEntityHeader> entities = searchResult.getEntities();
-        assertNotNull(entities);
-        assertEquals(entities.size(), 1);
-
-        AtlasEntityHeader dbEntity = entities.get(0);
-        assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
-        assertEquals(dbEntity.getDisplayText(), dbName);
-        assertEquals(dbEntity.getStatus(), Status.ACTIVE);
-
-        assertNotNull(dbEntity.getGuid());
-        assertNull(searchResult.getAttributes());
-        assertNull(searchResult.getFullTextResult());
-    }
-
-    @Test
-    public void testLikeSearchUsingDSL() throws Exception {
-        String dslQuery = DATABASE_TYPE_BUILTIN + " where " + QUALIFIED_NAME + " like \"da?a*\"";
-
-        AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
-        assertNotNull(searchResult);
-
-        List<AtlasEntityHeader> entities = searchResult.getEntities();
-        assertNotNull(entities);
-        assertEquals(entities.size(), 1);
-
-        AtlasEntityHeader dbEntity = entities.get(0);
-        assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
-        assertEquals(dbEntity.getDisplayText(), dbName);
-    }
-
-    @Test
-    public void testSearchFullTextOnDSLFailure() throws Exception {
-        String query = "*";
-        AtlasSearchResult searchResult = atlasClientV2.fullTextSearch(query);
-        assertNotNull(searchResult);
-        assertEquals(searchResult.getQueryText(), query);
-        assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT);
-    }
-
-    @Test(dependsOnMethods = "testSearchDSLLimits")
-    public void testSearchUsingFullText() throws Exception {
-        AtlasSearchResult searchResult = atlasClientV2.fullTextSearchWithParams(dbName, 10, 0);
-        assertNotNull(searchResult);
-
-        assertEquals(searchResult.getQueryText(), dbName);
-        assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT);
-
-        List<AtlasFullTextResult> fullTextResults = searchResult.getFullTextResult();
-        assertEquals(fullTextResults.size(), 1);
-
-        AtlasFullTextResult result = fullTextResults.get(0);
-        assertNotNull(result.getEntity());
-        assertEquals(result.getEntity().getTypeName(), DATABASE_TYPE_BUILTIN);
-        assertNotNull(result.getScore());
-
-        //API works without limit and offset
-        String query = dbName;
-        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
-        queryParams.add("query", query);
-        searchResult = atlasClientV2.fullTextSearch(query);
-        assertNotNull(searchResult);
-        assertEquals(searchResult.getFullTextResult().size(), 1);
-
-        //verify passed in limits and offsets are used
-        //higher limit and 0 offset returns all results
-        searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 0);
-        assertEquals(searchResult.getFullTextResult().size(), 1);
-
-        //offset is used
-        searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 1);
-        assertEquals(searchResult.getFullTextResult().size(), 1);
-
-        //limit is used
-        searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 0);
-        assertEquals(searchResult.getFullTextResult().size(), 1);
-
-        //higher offset returns 0 results
-        searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 2);
-        assertEquals(searchResult.getFullTextResult().size(), 1);
-    }
-
-    private void createTypes() throws Exception {
-        HierarchicalTypeDefinition<ClassType> dslTestTypeDefinition = TypesUtil
-                .createClassTypeDef("dsl_test_type", ImmutableSet.<String>of(),
-                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE));
-
-        HierarchicalTypeDefinition<TraitType> classificationTraitDefinition = TypesUtil
-                .createTraitTypeDef("Classification", ImmutableSet.<String>of(),
-                        TypesUtil.createRequiredAttrDef("tag", DataTypes.STRING_TYPE));
-        TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-                ImmutableList.of(classificationTraitDefinition), ImmutableList.of(dslTestTypeDefinition));
-        createType(typesDef);
-    }
-}
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
index 21060d1..ff8cb59 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
@@ -17,33 +17,23 @@
  */
 package org.apache.atlas.web.resources;
 
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.ws.rs.core.Response;
-
-import com.vividsolutions.jts.util.CollectionUtil;
-import org.apache.atlas.AtlasClient.EntityResult;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
-import org.apache.atlas.repository.converters.AtlasInstanceConverter;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
-import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.commons.collections.CollectionUtils;
-import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.mockito.Mockito.when;
+
 /**
  *   Unit test of {@link EntityResource}
  */
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
index c5cd3f6..84346ce 100644
--- a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
@@ -18,14 +18,13 @@
 
 package org.apache.atlas.web.security;
 
-import java.io.File;
-import java.util.Collection;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.web.TestUtils;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.io.FileUtils;
 import org.junit.Assert;
 import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
@@ -33,12 +32,15 @@
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.mockito.MockitoAnnotations;
 import org.testng.annotations.BeforeMethod;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.Collection;
+
 import static org.mockito.Mockito.when;
 
 public class FileAuthenticationTest {
@@ -69,7 +71,7 @@
         System.setProperty("atlas.conf", persistDir);
 
         applicationContext = new ClassPathXmlApplicationContext(
-                "spring-security.xml");
+                "test-spring-security.xml");
         authProvider = applicationContext
                 .getBean(org.apache.atlas.web.security.AtlasAuthenticationProvider.class);
 
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
index d1b0318..dd2df70 100644
--- a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
@@ -18,9 +18,9 @@
 
 package org.apache.atlas.web.service;
 
-import com.google.inject.Provider;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.ha.HAConfiguration;
 import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.commons.configuration.Configuration;
@@ -32,15 +32,10 @@
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.atlas.exception.AtlasBaseException;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.mockito.Mockito.*;
 
 public class ActiveInstanceElectorServiceTest {
 
@@ -75,7 +70,7 @@
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -96,7 +91,7 @@
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -108,7 +103,7 @@
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -129,7 +124,7 @@
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.stop();
@@ -151,7 +146,7 @@
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.stop();
@@ -165,7 +160,7 @@
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.stop();
 
@@ -185,23 +180,12 @@
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         ActiveInstanceElectorService activeInstanceElectorService =
                 new ActiveInstanceElectorService(configuration, changeHandlers, curatorFactory,
@@ -227,7 +211,7 @@
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
 
         activeInstanceElectorService.start();
@@ -250,23 +234,12 @@
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
@@ -297,7 +270,7 @@
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(), curatorFactory,
                         activeInstanceState, serviceState);
 
         activeInstanceElectorService.start();
@@ -324,23 +297,12 @@
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         ActiveInstanceElectorService activeInstanceElectorService =
                 new ActiveInstanceElectorService(configuration, changeHandlers, curatorFactory,
@@ -355,7 +317,7 @@
     @Test
     public void testActiveStateSetOnBecomingLeader() {
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
 
         activeInstanceElectorService.isLeader();
@@ -368,7 +330,7 @@
     @Test
     public void testPassiveStateSetOnLoosingLeadership() {
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
 
         activeInstanceElectorService.notLeader();
@@ -395,7 +357,7 @@
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.isLeader();
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
index 5d4ca97..41c3cb1 100755
--- a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
@@ -23,10 +23,10 @@
 import org.apache.atlas.Atlas;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.web.TestUtils;
-import org.apache.atlas.web.resources.AdminJerseyResourceIT;
-import org.apache.atlas.web.resources.EntityJerseyResourceIT;
-import org.apache.atlas.web.resources.MetadataDiscoveryJerseyResourceIT;
-import org.apache.atlas.web.resources.TypesJerseyResourceIT;
+import org.apache.atlas.web.integration.AdminJerseyResourceIT;
+import org.apache.atlas.web.integration.EntityJerseyResourceIT;
+import org.apache.atlas.web.integration.MetadataDiscoveryJerseyResourceIT;
+import org.apache.atlas.web.integration.TypesJerseyResourceIT;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
diff --git a/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java b/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
index 82abc1b..7365fae 100644
--- a/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
@@ -47,12 +47,7 @@
 import java.util.List;
 import java.util.Set;
 
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
 import static org.testng.AssertJUnit.assertTrue;
 
 public class SetupStepsTest {
@@ -94,8 +89,8 @@
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(setupStep1).run();
         verify(setupStep2).run();
@@ -147,8 +142,8 @@
                 thenReturn(lock);
         InOrder inOrder = inOrder(lock, setupStep1, setupStep2);
 
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         inOrder.verify(lock).acquire();
         inOrder.verify(setupStep1).run();
@@ -175,9 +170,9 @@
                 thenReturn(lock);
         InOrder inOrder = inOrder(lock, setupStep1);
 
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
         try {
-            setupSteps.runSetup(configuration);
+            setupSteps.runSetup();
         } catch (Exception e) {
             assertTrue(e instanceof SetupException);
         }
@@ -205,8 +200,8 @@
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(createBuilder).withACL(aclList);
         verify(createBuilder).forPath(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT+SetupSteps.SETUP_IN_PROGRESS_NODE,
@@ -231,8 +226,8 @@
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(deleteBuilder).forPath(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT+SetupSteps.SETUP_IN_PROGRESS_NODE);
     }
@@ -252,10 +247,10 @@
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
 
         try {
-            setupSteps.runSetup(configuration);
+            setupSteps.runSetup();
         } catch (Exception e) {
             assertTrue(e instanceof SetupException);
         }
diff --git a/webapp/src/test/resources/test-spring-security.xml b/webapp/src/test/resources/test-spring-security.xml
new file mode 100644
index 0000000..0ef15d7
--- /dev/null
+++ b/webapp/src/test/resources/test-spring-security.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    You under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+             xmlns:beans="http://www.springframework.org/schema/beans"
+             xmlns:security="http://www.springframework.org/schema/security"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xmlns:context="http://www.springframework.org/schema/context"
+             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+						http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+    <security:http pattern="/login.jsp" security="none" />
+    <security:http pattern="/css/**" security="none" />
+    <security:http pattern="/img/**" security="none" />
+    <security:http pattern="/libs/**" security="none" />
+    <security:http pattern="/js/**" security="none" />
+    <security:http pattern="/ieerror.html" security="none" />
+    <security:http pattern="/api/atlas/admin/status" security="none" />
+    <security:http pattern="/api/atlas/admin/metrics" security="none" />
+
+    <security:http create-session="always"
+                   entry-point-ref="entryPoint">
+        <security:session-management
+                session-fixation-protection="newSession" />
+        <intercept-url pattern="/**" access="isAuthenticated()" />
+        <custom-filter ref="ssoAuthenticationFilter" after="BASIC_AUTH_FILTER" />
+
+        <security:custom-filter ref="krbAuthenticationFilter" after="SERVLET_API_SUPPORT_FILTER" />
+        <security:custom-filter ref="csrfPreventionFilter" after="REMEMBER_ME_FILTER" />
+
+        <form-login
+                login-page="/login.jsp"
+                login-processing-url="/j_spring_security_check"
+                authentication-success-handler-ref="atlasAuthenticationSuccessHandler"
+                authentication-failure-handler-ref="atlasAuthenticationFailureHandler"
+                username-parameter="j_username"
+                password-parameter="j_password" />
+
+        <security:logout logout-success-url="/login.jsp" delete-cookies="ATLASSESSIONID"
+                         logout-url="/logout.html" />
+        <http-basic />
+        <headers disabled="true"/>
+        <csrf disabled="true"/>
+        <security:custom-filter position="LAST" ref="atlasAuthorizationFilter"/>
+    </security:http>
+
+    <beans:bean id="userDAO" class="org.apache.atlas.web.dao.UserDao" init-method="init"/>
+    <beans:bean id="userDetailsService" class="org.apache.atlas.web.service.UserService">
+        <beans:constructor-arg ref="userDAO"/>
+    </beans:bean>
+    <beans:bean id="atlasLDAPProvider" class="org.apache.atlas.web.security.AtlasLdapAuthenticationProvider"/>
+    <beans:bean id="atlasFileProvider" class="org.apache.atlas.web.security.AtlasFileAuthenticationProvider">
+        <beans:constructor-arg ref="userDetailsService"/>
+    </beans:bean>
+    <beans:bean id="atlasADProvider" class="org.apache.atlas.web.security.AtlasADAuthenticationProvider"/>
+    <beans:bean id="atlasAuthenticationProvider" class="org.apache.atlas.web.security.AtlasAuthenticationProvider">
+        <beans:constructor-arg index="0" ref="atlasLDAPProvider"/>
+        <beans:constructor-arg index="1" ref="atlasFileProvider"/>
+        <beans:constructor-arg index="2" ref="atlasADProvider"/>
+    </beans:bean>
+
+    <beans:bean id="krbAuthenticationFilter" class="org.apache.atlas.web.filters.AtlasAuthenticationFilter">
+    </beans:bean>
+
+    <beans:bean id="ssoAuthenticationFilter" class="org.apache.atlas.web.filters.AtlasKnoxSSOAuthenticationFilter">
+        <beans:constructor-arg name="authenticationProvider" ref="atlasAuthenticationProvider"/>
+    </beans:bean>
+
+    <beans:bean id="csrfPreventionFilter" class="org.apache.atlas.web.filters.AtlasCSRFPreventionFilter">
+    </beans:bean>
+
+    <beans:bean id="atlasAuthenticationSuccessHandler"
+                class="org.apache.atlas.web.security.AtlasAuthenticationSuccessHandler" />
+
+    <beans:bean id="atlasAuthenticationFailureHandler"
+                class="org.apache.atlas.web.security.AtlasAuthenticationFailureHandler" />
+
+    <beans:bean id="formAuthenticationEntryPoint"
+                class="org.apache.atlas.web.filters.AtlasAuthenticationEntryPoint">
+        <beans:constructor-arg value="/login.jsp"/>
+    </beans:bean>
+
+    <beans:bean id="authenticationEntryPoint"
+                class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
+        <beans:property name="realmName" value="atlas.com" />
+    </beans:bean>
+
+    <beans:bean id="entryPoint" class="org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint">
+        <beans:constructor-arg>
+            <beans:map>
+                <beans:entry key="hasHeader('User-Agent','Mozilla')" value-ref="formAuthenticationEntryPoint" />
+            </beans:map>
+        </beans:constructor-arg>
+        <beans:property name="defaultEntryPoint" ref="authenticationEntryPoint"/>
+    </beans:bean>
+
+
+    <security:authentication-manager
+            alias="authenticationManager">
+        <security:authentication-provider
+                ref="atlasAuthenticationProvider" />
+    </security:authentication-manager>
+
+    <security:global-method-security pre-post-annotations="enabled" />
+
+    <beans:bean id = "atlasAuthorizationFilter" class="org.apache.atlas.web.filters.AtlasAuthorizationFilter"/>
+</beans:beans>
diff --git a/webapp/src/test/webapp/WEB-INF/web.xml b/webapp/src/test/webapp/WEB-INF/web.xml
index 011bf37..2388fbf 100755
--- a/webapp/src/test/webapp/WEB-INF/web.xml
+++ b/webapp/src/test/webapp/WEB-INF/web.xml
@@ -24,51 +24,52 @@
     <display-name>Apache Atlas</display-name>
     <description>Metadata Management and Data Governance Platform over Hadoop</description>
 
-    <context-param>
-        <param-name>guice.packages</param-name>
-        <param-value>
-            org.apache.atlas.web.resources,org.apache.atlas.web.params,org.apache.atlas.web.rest,org.apache.atlas.web.errors
-        </param-value>
-    </context-param>
-  
-    <context-param>
-        <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
-        <param-value>true</param-value>
-    </context-param>
-
     <!--
         More information can be found here:
 
         https://jersey.java.net/nonav/apidocs/1.11/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html
      -->
 
+    <servlet>
+        <servlet-name>jersey-servlet</servlet-name>
+        <servlet-class>
+            com.sun.jersey.spi.spring.container.servlet.SpringServlet
+        </servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>jersey-servlet</servlet-name>
+        <url-pattern>/api/atlas/*</url-pattern>
+    </servlet-mapping>
+
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
-    
-    <filter>
-        <filter-name>guiceFilter</filter-name>
-        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
-    </filter>
-    
+
     <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-    
+
+    <filter>
+        <filter-name>AuditFilter</filter-name>
+        <filter-class>org.apache.atlas.web.filters.AuditFilter</filter-class>
+    </filter>
+
     <filter-mapping>
-        <filter-name>guiceFilter</filter-name>
+        <filter-name>AuditFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
 
     <listener>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
     </listener>
-    
-    <listener>
-        <listener-class>org.apache.atlas.web.listeners.TestGuiceServletConfig</listener-class>
-    </listener>
 
     <listener>
         <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
@@ -88,5 +89,5 @@
         </cookie-config>
     </session-config>
 
-	
+
 </web-app>