From 355c89c6c873f70e14b89bd0544b3505eb63b052 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Sun, 24 May 2020 20:34:40 +0200 Subject: Further simplify injection --- .../sevenwonders/server/config/TopicSubscriptionInterceptor.kt | 2 +- .../kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt | 5 +++-- .../luxons/sevenwonders/server/controllers/GameBrowserController.kt | 2 +- .../org/luxons/sevenwonders/server/controllers/GameController.kt | 2 +- .../org/luxons/sevenwonders/server/controllers/HomeController.kt | 2 +- .../org/luxons/sevenwonders/server/repositories/LobbyRepository.kt | 2 +- .../sevenwonders/server/validation/DestinationAccessValidator.kt | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) (limited to 'sw-server') diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/TopicSubscriptionInterceptor.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/TopicSubscriptionInterceptor.kt index 5342503b..5f298633 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/TopicSubscriptionInterceptor.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/TopicSubscriptionInterceptor.kt @@ -11,7 +11,7 @@ import org.springframework.messaging.support.ChannelInterceptor import org.springframework.stereotype.Component @Component -class TopicSubscriptionInterceptor @Autowired constructor( +class TopicSubscriptionInterceptor( private val destinationAccessValidator: DestinationAccessValidator ) : ChannelInterceptor { diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt index f68cddef..21eb7cc8 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt @@ -13,8 +13,9 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler @Configuration @EnableWebSocketMessageBroker -class WebSocketConfig @Autowired constructor(private val topicSubscriptionInterceptor: TopicSubscriptionInterceptor) : - WebSocketMessageBrokerConfigurer { +class WebSocketConfig( + private val topicSubscriptionInterceptor: TopicSubscriptionInterceptor +) : WebSocketMessageBrokerConfigurer { override fun configureMessageBroker(config: MessageBrokerRegistry) { // prefixes for all subscriptions diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt index 3fa2ac87..48928632 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt @@ -24,7 +24,7 @@ import java.security.Principal */ @Api(name = "GameBrowser") @Controller -class GameBrowserController @Autowired constructor( +class GameBrowserController( private val lobbyController: LobbyController, private val lobbyRepository: LobbyRepository, private val playerRepository: PlayerRepository, diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt index be5d916b..2a253136 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt @@ -22,7 +22,7 @@ import java.security.Principal */ @Api(name = "Game") @Controller -class GameController @Autowired constructor( +class GameController( private val template: SimpMessagingTemplate, private val playerRepository: PlayerRepository ) { diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/HomeController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/HomeController.kt index ff668fd9..cfc6b58f 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/HomeController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/HomeController.kt @@ -18,7 +18,7 @@ import java.security.Principal */ @Api(name = "Home") @Controller -class HomeController @Autowired constructor( +class HomeController( private val playerRepository: PlayerRepository ) { diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepository.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepository.kt index 5036266d..6c69b6d5 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepository.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepository.kt @@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicLong @Repository -class LobbyRepository @Autowired constructor() { +class LobbyRepository { private val lobbies = ConcurrentHashMap() diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidator.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidator.kt index 04daf311..4f6b6a6d 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidator.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidator.kt @@ -6,7 +6,7 @@ import org.springframework.stereotype.Component import java.util.regex.Pattern @Component -class DestinationAccessValidator @Autowired constructor(private val lobbyRepository: LobbyRepository) { +class DestinationAccessValidator(private val lobbyRepository: LobbyRepository) { fun hasAccess(username: String?, destination: String): Boolean { return when { -- cgit