From 817efe9bcc497d2910057c9ff7be45395373a2e9 Mon Sep 17 00:00:00 2001 From: Darren Walker <9861667+FluentSynergyDW@users.noreply.github.com> Date: Wed, 26 Jun 2019 10:18:54 +0100 Subject: [PATCH] Annotated classes with Singleton where this was missing. --- .../connector/ApiDefinitionConnector.scala | 3 ++- .../connector/ApiSubscriptionFieldsConnector.scala | 3 ++- .../connector/AwsApiGatewayConnector.scala | 3 ++- .../thirdpartyapplication/connector/EmailConnector.scala | 3 ++- .../connector/ThirdPartyDelegatedAuthorityConnector.scala | 3 ++- .../hmrc/thirdpartyapplication/connector/TotpConnector.scala | 3 ++- .../connector/Wso2ApiStoreConnector.scala | 3 ++- .../thirdpartyapplication/controllers/AccessController.scala | 3 ++- .../controllers/ApplicationController.scala | 3 ++- .../controllers/AwsRestoreController.scala | 3 ++- .../controllers/CollaboratorController.scala | 3 ++- .../controllers/DocumentationController.scala | 3 ++- .../controllers/GatekeeperController.scala | 3 ++- .../controllers/Wso2RestoreController.scala | 5 +++-- .../hmrc/thirdpartyapplication/services/AccessService.scala | 3 ++- .../thirdpartyapplication/services/ApplicationService.scala | 1 + .../hmrc/thirdpartyapplication/services/AuditService.scala | 5 +++-- .../thirdpartyapplication/services/AwsRestoreService.scala | 3 ++- .../thirdpartyapplication/services/CredentialService.scala | 3 ++- .../thirdpartyapplication/services/GatekeeperService.scala | 3 ++- .../thirdpartyapplication/services/SubscriptionService.scala | 3 ++- 21 files changed, 43 insertions(+), 22 deletions(-) diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiDefinitionConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiDefinitionConnector.scala index c9a79b02f..308852807 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiDefinitionConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiDefinitionConnector.scala @@ -18,13 +18,14 @@ package uk.gov.hmrc.thirdpartyapplication.connector import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.http.{HeaderCarrier, HttpReads} import uk.gov.hmrc.thirdpartyapplication.models.ApiDefinition import uk.gov.hmrc.play.bootstrap.http.HttpClient import scala.concurrent.{ExecutionContext, Future} +@Singleton class ApiDefinitionConnector @Inject()(httpClient: HttpClient, config: ApiDefinitionConfig)(implicit val ec: ExecutionContext) { def fetchAllAPIs(applicationId: UUID)(implicit rds: HttpReads[Seq[ApiDefinition]], hc: HeaderCarrier, ec: ExecutionContext): Future[Seq[ApiDefinition]] = { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiSubscriptionFieldsConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiSubscriptionFieldsConnector.scala index 2d19fad3e..0786cd993 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiSubscriptionFieldsConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/ApiSubscriptionFieldsConnector.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.thirdpartyapplication.connector -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} import uk.gov.hmrc.play.bootstrap.http.HttpClient import uk.gov.hmrc.thirdpartyapplication.models.HasSucceeded import scala.concurrent.{ExecutionContext, Future} +@Singleton class ApiSubscriptionFieldsConnector @Inject()(httpClient: HttpClient, config: ApiSubscriptionFieldsConfig)(implicit val ec: ExecutionContext) { def deleteSubscriptions(clientId: String)(implicit hc: HeaderCarrier): Future[HasSucceeded] = { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/AwsApiGatewayConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/AwsApiGatewayConnector.scala index bfb62e368..64de70081 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/AwsApiGatewayConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/AwsApiGatewayConnector.scala @@ -16,7 +16,7 @@ package uk.gov.hmrc.thirdpartyapplication.connector -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import play.api.http.ContentTypes.JSON import play.api.http.HeaderNames.CONTENT_TYPE @@ -29,6 +29,7 @@ import uk.gov.hmrc.thirdpartyapplication.models.RateLimitTier.RateLimitTier import scala.concurrent.{ExecutionContext, Future} import scala.util.control.NonFatal +@Singleton class AwsApiGatewayConnector @Inject()(http: HttpClient, config: AwsApiGatewayConfig) (implicit val ec: ExecutionContext) { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/EmailConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/EmailConnector.scala index 984ab6a38..a4b51e2bf 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/EmailConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/EmailConnector.scala @@ -16,7 +16,7 @@ package uk.gov.hmrc.thirdpartyapplication.connector -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import play.api.libs.json.Json import play.mvc.Http.Status._ @@ -37,6 +37,7 @@ object SendEmailRequest { implicit val sendEmailRequestFmt = Json.format[SendEmailRequest] } +@Singleton class EmailConnector @Inject()(httpClient: HttpClient, config: EmailConfig)(implicit val ec: ExecutionContext) { val serviceUrl = config.baseUrl val devHubBaseUrl = config.devHubBaseUrl diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/ThirdPartyDelegatedAuthorityConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/ThirdPartyDelegatedAuthorityConnector.scala index 786b0b78b..fab0368db 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/ThirdPartyDelegatedAuthorityConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/ThirdPartyDelegatedAuthorityConnector.scala @@ -16,13 +16,14 @@ package uk.gov.hmrc.thirdpartyapplication.connector -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} import uk.gov.hmrc.play.bootstrap.http.HttpClient import uk.gov.hmrc.thirdpartyapplication.models.HasSucceeded import scala.concurrent.{ExecutionContext, Future} +@Singleton class ThirdPartyDelegatedAuthorityConnector @Inject()(httpClient: HttpClient, config: ThirdPartyDelegatedAuthorityConfig)(implicit val ec: ExecutionContext) { def revokeApplicationAuthorities(clientId: String)(implicit hc: HeaderCarrier): Future[HasSucceeded] = { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/TotpConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/TotpConnector.scala index 45f68f666..4bbc447b2 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/TotpConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/TotpConnector.scala @@ -16,7 +16,7 @@ package uk.gov.hmrc.thirdpartyapplication.connector -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.http.Status.CREATED import uk.gov.hmrc.http.{HeaderCarrier, HttpReads, HttpResponse} import uk.gov.hmrc.play.bootstrap.http.HttpClient @@ -25,6 +25,7 @@ import uk.gov.hmrc.thirdpartyapplication.models.Totp import scala.concurrent.{ExecutionContext, Future} +@Singleton class TotpConnector @Inject()(httpClient: HttpClient, config: TotpConfig)(implicit val ec: ExecutionContext) { def generateTotp()(implicit rds: HttpReads[HttpResponse], hc: HeaderCarrier, ec: ExecutionContext): Future[Totp] = { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/connector/Wso2ApiStoreConnector.scala b/app/uk/gov/hmrc/thirdpartyapplication/connector/Wso2ApiStoreConnector.scala index f7d9b9327..214f9a7c5 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/connector/Wso2ApiStoreConnector.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/connector/Wso2ApiStoreConnector.scala @@ -17,7 +17,7 @@ package uk.gov.hmrc.thirdpartyapplication.connector import com.google.common.base.Charsets -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import play.api.http.ContentTypes.FORM import play.api.http.HeaderNames.{CONTENT_TYPE, COOKIE, SET_COOKIE} @@ -34,6 +34,7 @@ import scala.concurrent._ import scala.concurrent.duration._ import scala.util.{Failure, Success, Try} +@Singleton class Wso2ApiStoreConnector @Inject()(httpClient: HttpClient, config: Wso2ApiStoreConfig)(implicit val ec: ExecutionContext) { val serviceUrl = s"${config.baseUrl}/store/site/blocks" diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/AccessController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/AccessController.scala index 59d4d0017..9c38aae0c 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/AccessController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/AccessController.scala @@ -17,8 +17,8 @@ package uk.gov.hmrc.thirdpartyapplication.controllers import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.libs.json.Json.toJson import play.api.mvc.BodyParsers.parse.json import uk.gov.hmrc.thirdpartyapplication.connector.{AuthConfig, AuthConnector} @@ -27,6 +27,7 @@ import uk.gov.hmrc.thirdpartyapplication.services.{AccessService, ApplicationSer import scala.concurrent.ExecutionContext.Implicits.global +@Singleton class AccessController @Inject()(accessService: AccessService, val authConnector: AuthConnector, val applicationService: ApplicationService, diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/ApplicationController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/ApplicationController.scala index 44349aa06..39ac2585b 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/ApplicationController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/ApplicationController.scala @@ -18,7 +18,7 @@ package uk.gov.hmrc.thirdpartyapplication.controllers import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.libs.json.Json.toJson import play.api.libs.json._ import play.api.mvc._ @@ -35,6 +35,7 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future import scala.util.{Failure, Success, Try} +@Singleton class ApplicationController @Inject()(val applicationService: ApplicationService, val authConnector: AuthConnector, credentialService: CredentialService, diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/AwsRestoreController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/AwsRestoreController.scala index 6c786a4e7..61c261a9a 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/AwsRestoreController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/AwsRestoreController.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.thirdpartyapplication.controllers -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.mvc.Action import uk.gov.hmrc.thirdpartyapplication.services.AwsRestoreService import scala.concurrent.ExecutionContext.Implicits.global +@Singleton class AwsRestoreController @Inject()(awsRestoreService: AwsRestoreService) extends CommonController { def restoreAwsData() = Action.async { implicit request => diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/CollaboratorController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/CollaboratorController.scala index 86a1e5646..5124581d2 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/CollaboratorController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/CollaboratorController.scala @@ -16,7 +16,7 @@ package uk.gov.hmrc.thirdpartyapplication.controllers -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.libs.json.Json.toJson import play.api.mvc._ import uk.gov.hmrc.thirdpartyapplication.services.SubscriptionService @@ -24,6 +24,7 @@ import uk.gov.hmrc.thirdpartyapplication.util.http.HttpHeaders._ import scala.concurrent.ExecutionContext.Implicits.global +@Singleton class CollaboratorController @Inject()(subscriptionService: SubscriptionService) extends CommonController { override implicit def hc(implicit request: RequestHeader) = { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/DocumentationController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/DocumentationController.scala index 552a1766b..a19e37e7a 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/DocumentationController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/DocumentationController.scala @@ -17,7 +17,7 @@ package uk.gov.hmrc.thirdpartyapplication.controllers import controllers.AssetsBuilder -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Configuration import play.api.http.HttpErrorHandler import play.api.mvc.Action @@ -25,6 +25,7 @@ import uk.gov.hmrc.thirdpartyapplication.models.ApiAccess import uk.gov.hmrc.play.bootstrap.controller.BaseController import uk.gov.hmrc.thirdpartyapplication.views.txt +@Singleton class DocumentationController @Inject()(httpErrorHandler: HttpErrorHandler, config: DocumentationConfig) extends AssetsBuilder(httpErrorHandler) with BaseController { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/GatekeeperController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/GatekeeperController.scala index 76d339dd0..651947525 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/GatekeeperController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/GatekeeperController.scala @@ -17,8 +17,8 @@ package uk.gov.hmrc.thirdpartyapplication.controllers import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.libs.json.Json import uk.gov.hmrc.thirdpartyapplication.connector.{AuthConfig, AuthConnector} import uk.gov.hmrc.thirdpartyapplication.controllers.ErrorCode._ @@ -28,6 +28,7 @@ import uk.gov.hmrc.thirdpartyapplication.services.{ApplicationService, Gatekeepe import scala.concurrent.ExecutionContext.Implicits.global +@Singleton class GatekeeperController @Inject()(val authConnector: AuthConnector, val applicationService: ApplicationService, gatekeeperService: GatekeeperService, val authConfig: AuthConfig) extends CommonController with AuthorisationWrapper { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/controllers/Wso2RestoreController.scala b/app/uk/gov/hmrc/thirdpartyapplication/controllers/Wso2RestoreController.scala index 7ae8d5afc..d10245d4b 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/controllers/Wso2RestoreController.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/controllers/Wso2RestoreController.scala @@ -16,12 +16,13 @@ package uk.gov.hmrc.thirdpartyapplication.controllers -import javax.inject.Inject - +import javax.inject.{Inject, Singleton} import play.api.mvc.Action import uk.gov.hmrc.thirdpartyapplication.services.Wso2RestoreService + import scala.concurrent.ExecutionContext.Implicits.global +@Singleton class Wso2RestoreController @Inject()(wso2RestoreService: Wso2RestoreService) extends CommonController { def restoreWso2Data() = Action.async { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/AccessService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/AccessService.scala index ca1a9b186..9d960b2ce 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/AccessService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/AccessService.scala @@ -17,8 +17,8 @@ package uk.gov.hmrc.thirdpartyapplication.services import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.thirdpartyapplication.controllers.{OverridesRequest, OverridesResponse, ScopeRequest, ScopeResponse} import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} import uk.gov.hmrc.thirdpartyapplication.models.AccessType.{PRIVILEGED, ROPC} @@ -30,6 +30,7 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future import scala.concurrent.Future.{failed, sequence, successful} +@Singleton class AccessService @Inject()(applicationRepository: ApplicationRepository, auditService: AuditService) { def readScopes(applicationId: UUID): Future[ScopeResponse] = diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/ApplicationService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/ApplicationService.scala index 6daa5e866..b17901b14 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/ApplicationService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/ApplicationService.scala @@ -510,6 +510,7 @@ class ApplicationService @Inject()(applicationRepository: ApplicationRepository, private def loggedInUser(implicit hc: HeaderCarrier) = hc.headers find (_._1 == LOGGED_IN_USER_EMAIL_HEADER) map (_._2) getOrElse "" } +@Singleton class ApplicationLockKeeper @Inject()(reactiveMongoComponent: ReactiveMongoComponent) extends LockKeeper { override def repo: LockRepository = { LockMongoRepository(reactiveMongoComponent.mongoConnector.db) diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/AuditService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/AuditService.scala index fe0d8e220..9e73faccb 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/AuditService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/AuditService.scala @@ -20,18 +20,19 @@ import java.net.URLDecoder import java.nio.charset.StandardCharsets import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.http.HeaderCarrier -import uk.gov.hmrc.thirdpartyapplication.models.{ApplicationData, Collaborator, OverrideFlag, Standard} import uk.gov.hmrc.play.audit.AuditExtensions.auditHeaderCarrier import uk.gov.hmrc.play.audit.http.connector.{AuditConnector, AuditResult} import uk.gov.hmrc.play.audit.model.DataEvent +import uk.gov.hmrc.thirdpartyapplication.models.{ApplicationData, Collaborator, OverrideFlag, Standard} import uk.gov.hmrc.thirdpartyapplication.services.AuditAction.{AppNameChanged, AppPrivacyPolicyUrlChanged, AppRedirectUrisChanged, AppTermsAndConditionsUrlChanged} import uk.gov.hmrc.thirdpartyapplication.util.http.HttpHeaders._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future +@Singleton class AuditService @Inject()(val auditConnector: AuditConnector) { def audit(action: AuditAction, data: Map[String, String])(implicit hc: HeaderCarrier): Future[AuditResult] = diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/AwsRestoreService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/AwsRestoreService.scala index 7c4d3295d..739d17dde 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/AwsRestoreService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/AwsRestoreService.scala @@ -16,7 +16,7 @@ package uk.gov.hmrc.thirdpartyapplication.services -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import uk.gov.hmrc.http.HeaderCarrier import uk.gov.hmrc.thirdpartyapplication.connector.{AwsApiGatewayConnector, UpsertApplicationRequest} @@ -27,6 +27,7 @@ import uk.gov.hmrc.thirdpartyapplication.repository.{ApplicationRepository, Subs import scala.concurrent.Future.sequence import scala.concurrent.{ExecutionContext, Future} +@Singleton class AwsRestoreService @Inject()(awsApiGatewayConnector: AwsApiGatewayConnector, applicationRepository: ApplicationRepository, subscriptionRepository: SubscriptionRepository) { diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/CredentialService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/CredentialService.scala index 045fd2109..9db803dd4 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/CredentialService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/CredentialService.scala @@ -17,8 +17,8 @@ package uk.gov.hmrc.thirdpartyapplication.services import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import uk.gov.hmrc.thirdpartyapplication.controllers.{ClientSecretRequest, ValidationRequest} import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} import uk.gov.hmrc.thirdpartyapplication.models.Environment._ @@ -29,6 +29,7 @@ import uk.gov.hmrc.thirdpartyapplication.services.AuditAction._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future +@Singleton class CredentialService @Inject()(applicationRepository: ApplicationRepository, auditService: AuditService, trustedApplications: TrustedApplications, diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/GatekeeperService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/GatekeeperService.scala index 1c0e400be..8aa9d4f30 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/GatekeeperService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/GatekeeperService.scala @@ -18,7 +18,7 @@ package uk.gov.hmrc.thirdpartyapplication.services import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import uk.gov.hmrc.thirdpartyapplication.connector.{ApiSubscriptionFieldsConnector, EmailConnector, ThirdPartyDelegatedAuthorityConnector} import uk.gov.hmrc.thirdpartyapplication.controllers.{DeleteApplicationRequest, RejectUpliftRequest} @@ -36,6 +36,7 @@ import scala.concurrent.Future import scala.concurrent.Future._ import scala.util.Failure +@Singleton class GatekeeperService @Inject()(applicationRepository: ApplicationRepository, stateHistoryRepository: StateHistoryRepository, subscriptionRepository: SubscriptionRepository, diff --git a/app/uk/gov/hmrc/thirdpartyapplication/services/SubscriptionService.scala b/app/uk/gov/hmrc/thirdpartyapplication/services/SubscriptionService.scala index 510a4512c..e4cb1ef8c 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/services/SubscriptionService.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/services/SubscriptionService.scala @@ -18,7 +18,7 @@ package uk.gov.hmrc.thirdpartyapplication.services import java.util.UUID -import javax.inject.Inject +import javax.inject.{Inject, Singleton} import play.api.Logger import uk.gov.hmrc.http.{HeaderCarrier, NotFoundException} import uk.gov.hmrc.thirdpartyapplication.connector.ApiDefinitionConnector @@ -31,6 +31,7 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future import scala.concurrent.Future.{failed, sequence, successful} +@Singleton class SubscriptionService @Inject()(applicationRepository: ApplicationRepository, subscriptionRepository: SubscriptionRepository, apiDefinitionConnector: ApiDefinitionConnector,