summaryrefslogtreecommitdiff
path: root/sw-server
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-24 20:34:40 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-24 20:36:59 +0200
commit355c89c6c873f70e14b89bd0544b3505eb63b052 (patch)
tree1e48728f13cf232c67d2f4db375bb2ee53a7fbef /sw-server
parentSimplify injection and fix tests (diff)
downloadseven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.tar.gz
seven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.tar.bz2
seven-wonders-355c89c6c873f70e14b89bd0544b3505eb63b052.zip
Further simplify injection
Diffstat (limited to 'sw-server')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/TopicSubscriptionInterceptor.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt5
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/HomeController.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepository.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidator.kt2
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 {
bgstack15