Bump to JavaFX 11 and Spring Boot 2

This commit is contained in:
Charles Gould 2019-02-10 15:24:00 -05:00
parent a5d9c7eee6
commit 8392543515
6 changed files with 30 additions and 8 deletions

View File

@ -11,6 +11,10 @@
<artifactId>lingo-websocket-client</artifactId> <artifactId>lingo-websocket-client</artifactId>
<name>Lingo WebSocket :: Client</name> <name>Lingo WebSocket :: Client</name>
<properties>
<javafx.version>11.0.2</javafx.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -23,6 +27,23 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId> <artifactId>spring-boot-starter-websocket</artifactId>
</dependency> </dependency>
<!-- JavaFX -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -4,6 +4,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -29,7 +30,7 @@ public class LingoClient extends Application {
public void init() throws Exception { public void init() throws Exception {
ConfigurableApplicationContext context = startSpringApplication(); ConfigurableApplicationContext context = startSpringApplication();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Lingo.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Lingo.fxml"));
loader.setControllerFactory(clazz -> context.getBean(clazz)); loader.setControllerFactory(context::getBean);
root = loader.load(); root = loader.load();
} }
@ -51,9 +52,9 @@ public class LingoClient extends Application {
private ConfigurableApplicationContext startSpringApplication() { private ConfigurableApplicationContext startSpringApplication() {
SpringApplication application = new SpringApplication(LingoClient.class); SpringApplication application = new SpringApplication(LingoClient.class);
String[] args = getParameters().getRaw().stream().toArray(String[]::new); String[] args = getParameters().getRaw().toArray(new String[0]);
application.setHeadless(false); application.setHeadless(false);
application.setWebEnvironment(false); application.setWebApplicationType(WebApplicationType.NONE);
return application.run(args); return application.run(args);
} }

View File

@ -71,7 +71,7 @@ public class LingoPresenter implements FxmlController {
Platform.runLater(() -> { Platform.runLater(() -> {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/LingoMultiplayer.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/LingoMultiplayer.fxml"));
loader.setControllerFactory(clazz -> multiplayerContext.getBean(clazz)); loader.setControllerFactory(multiplayerContext::getBean);
try { try {
content.setCenter(loader.load()); content.setCenter(loader.load());
} catch (IOException e) { } catch (IOException e) {

View File

@ -15,7 +15,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.3.2</version> <version>3.8.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version> <version>2.1.2.RELEASE</version>
</parent> </parent>
<groupId>com.charego</groupId> <groupId>com.charego</groupId>

View File

@ -5,13 +5,13 @@ import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@Configuration @Configuration
@EnableWebSocketMessageBroker @EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override @Override
public void configureClientInboundChannel(ChannelRegistration registration) { public void configureClientInboundChannel(ChannelRegistration registration) {