diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-24 20:34:40 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-24 20:36:59 +0200 |
commit | 355c89c6c873f70e14b89bd0544b3505eb63b052 (patch) | |
tree | 1e48728f13cf232c67d2f4db375bb2ee53a7fbef /sw-server/src/main/kotlin/org/luxons | |
parent | Simplify injection and fix tests (diff) | |
download | seven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.tar.gz seven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.tar.bz2 seven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.zip |
Further simplify injection
Diffstat (limited to 'sw-server/src/main/kotlin/org/luxons')
7 files changed, 9 insertions, 8 deletions
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<Long, Lobby>() 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 { |