Skip to content

Commit

Permalink
Use @PostConstruct annotation to wired Environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kotlinc0der committed Aug 23, 2019
1 parent 6fa344d commit 4adc5e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -29,7 +28,7 @@ public class WebSocketChatServer {

/**
* All chat sessions.
* Multiple Sessions are associated with a single a user to account for the case where a user logs in to chat room on multiple tabs
* Multiple Sessions are associated with a single user to account for the case where a user logs in to a chat room on multiple tabs
*/
private static Map<String, Set<Session>> onlineSessions = new ConcurrentHashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.PostConstruct;
import java.io.File;
import java.util.List;

Expand All @@ -40,10 +41,14 @@ public class WebSocketChatServerTest {

private WebDriver webDriver;

@Before
public void init() {
@PostConstruct
public void initUrls() {
BASE_URL = environment.getProperty("app.base.url");
CHAT_URL = environment.getProperty("app.chat.url");
}

@Before
public void init() {
webDriver = initWebDriver();
}

Expand Down

0 comments on commit 4adc5e4

Please sign in to comment.