├── IgniteDemo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── springignite │ │ │ ├── ExampleApp.java │ │ │ ├── PrimaryController.java │ │ │ ├── SecondaryController.java │ │ │ ├── SpringBootIgniteApp.java │ │ │ └── service │ │ │ └── WeatherService.java │ └── resources │ │ └── com │ │ └── asgteach │ │ └── springignite │ │ ├── primary.fxml │ │ ├── secondary.fxml │ │ └── styles.css │ └── test │ └── java │ └── com │ └── gluonhq │ └── springignitedemo │ └── SpringIgniteDemoApplicationTests.java ├── Music.sql ├── README.md ├── SpringBootClientFXMultiThread ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── springboot │ │ │ ├── MusicClientApp.java │ │ │ ├── MusicFXApp.java │ │ │ ├── ViewController.java │ │ │ ├── domain │ │ │ └── MusicCategory.java │ │ │ └── service │ │ │ └── MusicRESTService.java │ └── resources │ │ ├── application.properties │ │ └── com │ │ └── asgteach │ │ └── springboot │ │ └── view.fxml │ └── test │ └── java │ └── com │ └── asgteach │ └── springbootrestjfx │ └── SpringbootrestjfxApplicationTests.java ├── SpringBootRest ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── nb-configuration.xml ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── springbootrest │ │ │ ├── SpringbootrestApplication.java │ │ │ ├── domain │ │ │ └── MusicCategory.java │ │ │ └── service │ │ │ ├── MusicCategoryNotFoundException.java │ │ │ ├── MusicCategoryResource.java │ │ │ └── MusicRepository.java │ └── resources │ │ ├── application.properties │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── asgteach │ └── springbootrest │ └── SpringbootrestApplicationTests.java ├── SpringBootRestMySql ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── nb-configuration.xml ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── springbootrest │ │ │ ├── SpringbootrestApplication.java │ │ │ ├── domain │ │ │ └── MusicCategory.java │ │ │ └── service │ │ │ ├── MusicCategoryNotFoundException.java │ │ │ ├── MusicCategoryResource.java │ │ │ └── MusicRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── asgteach │ └── springbootrest │ └── SpringbootrestApplicationTests.java ├── SpringBootWebClientFX ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── springboot │ │ │ ├── MusicClientApp.java │ │ │ ├── MusicFXApp.java │ │ │ ├── ViewController.java │ │ │ ├── domain │ │ │ └── MusicCategory.java │ │ │ └── service │ │ │ └── MusicRESTService.java │ └── resources │ │ ├── application.properties │ │ └── com │ │ └── asgteach │ │ └── springboot │ │ └── view.fxml │ └── test │ └── java │ └── com │ └── asgteach │ └── springbootrestjfx │ └── SpringbootrestjfxApplicationTests.java ├── WeatherJFXClient ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── nbactions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── asgteach │ │ │ └── weatherclient │ │ │ ├── PrimaryController.java │ │ │ ├── SecondaryController.java │ │ │ ├── WeatherClientApplication.java │ │ │ ├── WeatherFXApp.java │ │ │ ├── domain │ │ │ └── Weather.java │ │ │ └── service │ │ │ └── WeatherClient.java │ └── resources │ │ ├── application.properties │ │ └── com │ │ └── asgteach │ │ └── weatherclient │ │ ├── primary.fxml │ │ ├── secondary.fxml │ │ └── styles.css │ └── test │ └── java │ └── com │ └── gluonhq │ └── springignitedemo │ └── SpringIgniteDemoApplicationTests.java └── WeatherService ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── nbactions.xml ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── asgteach │ │ └── weatherservice │ │ ├── WeatherController.java │ │ ├── WeatherServiceApplication.java │ │ ├── domain │ │ ├── Forecaster.java │ │ └── Weather.java │ │ └── repository │ │ ├── ReactiveWeatherRepository.java │ │ └── WeatherRepository.java └── resources │ └── application.properties └── test └── java └── com └── asgteach └── weatherservice └── WeatherserviceApplicationTests.java /IgniteDemo/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /IgniteDemo/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.6"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 26 | */ 27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 29 | 30 | /** 31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 32 | * use instead of the default one. 33 | */ 34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 35 | ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = 41 | ".mvn/wrapper/maven-wrapper.jar"; 42 | 43 | /** 44 | * Name of the property which should be used to override the default download url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 54 | // wrapperUrl parameter. 55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 56 | String url = DEFAULT_DOWNLOAD_URL; 57 | if(mavenWrapperPropertyFile.exists()) { 58 | FileInputStream mavenWrapperPropertyFileInputStream = null; 59 | try { 60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 61 | Properties mavenWrapperProperties = new Properties(); 62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 64 | } catch (IOException e) { 65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 66 | } finally { 67 | try { 68 | if(mavenWrapperPropertyFileInputStream != null) { 69 | mavenWrapperPropertyFileInputStream.close(); 70 | } 71 | } catch (IOException e) { 72 | // Ignore ... 73 | } 74 | } 75 | } 76 | System.out.println("- Downloading from: " + url); 77 | 78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 79 | if(!outputFile.getParentFile().exists()) { 80 | if(!outputFile.getParentFile().mkdirs()) { 81 | System.out.println( 82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 83 | } 84 | } 85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 86 | try { 87 | downloadFileFromURL(url, outputFile); 88 | System.out.println("Done"); 89 | System.exit(0); 90 | } catch (Throwable e) { 91 | System.out.println("- Error downloading"); 92 | e.printStackTrace(); 93 | System.exit(1); 94 | } 95 | } 96 | 97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 99 | String username = System.getenv("MVNW_USERNAME"); 100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 101 | Authenticator.setDefault(new Authenticator() { 102 | @Override 103 | protected PasswordAuthentication getPasswordAuthentication() { 104 | return new PasswordAuthentication(username, password); 105 | } 106 | }); 107 | } 108 | URL website = new URL(urlString); 109 | ReadableByteChannel rbc; 110 | rbc = Channels.newChannel(website.openStream()); 111 | FileOutputStream fos = new FileOutputStream(destination); 112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 113 | fos.close(); 114 | rbc.close(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /IgniteDemo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gailasgteach/JavaFX-SpringBoot-Samples/91efd37a37c5560541a25ade6b0932d8e2606cff/IgniteDemo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /IgniteDemo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /IgniteDemo/README.md: -------------------------------------------------------------------------------- 1 | # Spring Ignite Demo 2 | 3 | Simple application, demonstrating the use of [Gluon Ignite](https://github.com/gluonhq/ignite) with SpringBoot. 4 | -------------------------------------------------------------------------------- /IgniteDemo/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /IgniteDemo/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | run 5 | 6 | jar 7 | 8 | 9 | clean 10 | javafx:run 11 | 12 | 13 | 14 | debug 15 | 16 | jar 17 | 18 | 19 | process-classes 20 | org.codehaus.mojo:exec-maven-plugin:3.0.0:exec 21 | 22 | 23 | -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} 24 | ${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs} 25 | 26 | com.asgteach.springignite.SpringBootIgniteApp 27 | java 28 | true 29 | 30 | 31 | 32 | profile 33 | 34 | jar 35 | 36 | 37 | process-classes 38 | org.codehaus.mojo:exec-maven-plugin:3.0.0:exec 39 | 40 | 41 | 42 | ${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs} 43 | com.asgteach.springignite.SpringBootIgniteApp 44 | java 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /IgniteDemo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.springframework.boot 9 | spring-boot-starter-parent 10 | 2.6.2 11 | 12 | 13 | com.asgteach 14 | spring-ignite-demo 15 | 0.0.1-SNAPSHOT 16 | IgniteDemo 17 | Demo project for Spring Boot with Gluon Ignite 18 | 19 | 17 20 | 17.0.0.1 21 | 0.0.8 22 | com.asgteach.springignite.SpringBootIgniteApp 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-test 32 | test 33 | 34 | 35 | org.openjfx 36 | javafx-controls 37 | ${javafxVersion} 38 | 39 | 40 | org.openjfx 41 | javafx-fxml 42 | ${javafxVersion} 43 | 44 | 45 | com.gluonhq 46 | ignite-spring 47 | 1.2.2 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.springframework.boot 55 | spring-boot-maven-plugin 56 | 57 | 58 | org.openjfx 59 | javafx-maven-plugin 60 | ${javafx-maven-plugin-version} 61 | 62 | ${mainClassName} 63 | 64 | 65 | 66 | 67 | default-cli 68 | 69 | ${mainClassName} 70 | 71 | 72 | 73 | 74 | debug 75 | 76 | ${mainClassName} 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/java/com/asgteach/springignite/ExampleApp.java: -------------------------------------------------------------------------------- 1 | // ExampleApp.java - ExampleApp interface 2 | package com.asgteach.springignite; 3 | import java.net.URL; 4 | 5 | public interface ExampleApp { 6 | default URL getViewLocation() { 7 | return getClass().getResource("primary.fxml"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/java/com/asgteach/springignite/PrimaryController.java: -------------------------------------------------------------------------------- 1 | // PrimaryController.java - JavaFX primary controller 2 | package com.asgteach.springignite; 3 | import com.asgteach.springignite.service.WeatherService; 4 | import java.io.IOException; 5 | import java.net.URL; 6 | import java.util.ResourceBundle; 7 | import javafx.event.ActionEvent; 8 | import javafx.fxml.FXML; 9 | import javafx.fxml.FXMLLoader; 10 | import javafx.fxml.Initializable; 11 | import javafx.scene.control.Label; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | 15 | @Component 16 | public class PrimaryController implements Initializable { 17 | 18 | @FXML 19 | private Label weatherLabel; 20 | 21 | @Autowired 22 | private WeatherService weatherService; 23 | 24 | @Autowired 25 | private FXMLLoader fxmlLoader; 26 | 27 | @FXML 28 | public void loadWeatherForecast(ActionEvent actionEvent) { 29 | System.out.println("Load Weather Forecast Action"); 30 | this.weatherLabel.setText(weatherService.getWeatherForecast()); 31 | } 32 | 33 | 34 | @Override 35 | public void initialize(URL location, ResourceBundle resources) { 36 | System.out.println("PrimaryController initialized!"); 37 | } 38 | 39 | @FXML 40 | private void switchToSecondary(ActionEvent event) throws IOException { 41 | System.out.println("Switch to Secondary Action"); 42 | fxmlLoader.setLocation(getClass().getResource("secondary.fxml")); 43 | SpringBootIgniteApp.setRoot(fxmlLoader.load()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/java/com/asgteach/springignite/SecondaryController.java: -------------------------------------------------------------------------------- 1 | // SecondaryController.java - JavaFX secondary controller 2 | package com.asgteach.springignite; 3 | import java.io.IOException; 4 | import java.net.URL; 5 | import java.util.ResourceBundle; 6 | import javafx.event.ActionEvent; 7 | import javafx.fxml.FXML; 8 | import javafx.fxml.FXMLLoader; 9 | import javafx.fxml.Initializable; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Component; 12 | 13 | @Component 14 | public class SecondaryController implements Initializable { 15 | 16 | @Autowired 17 | private FXMLLoader fxmlLoader; 18 | 19 | @Override 20 | public void initialize(URL location, ResourceBundle resources) { 21 | System.out.println("SecondaryController initialized!"); 22 | } 23 | 24 | @FXML 25 | private void switchToPrimary(ActionEvent event) throws IOException { 26 | System.out.println("Switch to Primary Action"); 27 | fxmlLoader.setLocation(getClass().getResource("primary.fxml")); 28 | SpringBootIgniteApp.setRoot(fxmlLoader.load()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/java/com/asgteach/springignite/SpringBootIgniteApp.java: -------------------------------------------------------------------------------- 1 | // SpringBootIgniteApp.java - Main application 2 | package com.asgteach.springignite; 3 | import com.gluonhq.ignite.spring.SpringContext; 4 | import java.io.IOException; 5 | import javafx.application.Application; 6 | import javafx.fxml.FXMLLoader; 7 | import javafx.scene.Parent; 8 | import javafx.scene.Scene; 9 | import javafx.stage.Stage; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.SpringApplication; 12 | import org.springframework.boot.autoconfigure.SpringBootApplication; 13 | import org.springframework.context.annotation.ComponentScan; 14 | 15 | @SpringBootApplication 16 | @ComponentScan({ 17 | "com.gluonhq.ignite.spring", 18 | "com.asgteach.springignite.service" 19 | }) 20 | public class SpringBootIgniteApp extends Application 21 | implements ExampleApp { 22 | 23 | public static void main(String[] args) { 24 | Application.launch(SpringBootIgniteApp.class, args); 25 | } 26 | 27 | @Autowired 28 | private FXMLLoader loader; 29 | 30 | private final SpringContext context = new SpringContext(this); 31 | private static Scene scene; 32 | 33 | @Override 34 | public void start(Stage stage) throws IOException { 35 | context.init(() -> SpringApplication.run(SpringBootIgniteApp.class)); 36 | loader.setLocation(getViewLocation()); 37 | Parent primaryView = loader.load(); 38 | stage.setTitle("Spring Boot Ignite Example"); 39 | stage.setScene(scene = new Scene(primaryView)); 40 | stage.show(); 41 | } 42 | 43 | static void setRoot(Parent view) { 44 | scene.setRoot(view); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/java/com/asgteach/springignite/service/WeatherService.java: -------------------------------------------------------------------------------- 1 | // WeatherService.java - Weather service 2 | package com.asgteach.springignite.service; 3 | import org.springframework.stereotype.Service; 4 | 5 | @Service 6 | public class WeatherService { 7 | private final String[] forecasts = { 8 | "Hot and sunny. Bring your sunscreen.", 9 | "It's gonna snow. Look out, winter is coming.", 10 | "Foggy and cold. Time for an espresso.", 11 | "Rain is on the way. Don't forget your umbrella.", 12 | "Breezy with a few fluffy clouds. Let's go sailing." 13 | }; 14 | 15 | public String getWeatherForecast() { 16 | int index = (int)(Math.random() * forecasts.length); 17 | return forecasts[index]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /IgniteDemo/src/main/resources/com/asgteach/springignite/primary.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 18 | 20 | 21 | 22 |