This repository gathers Spring code examples coming from various websites and books. It also includes several build scripts (Bash scripts, batch files, Gradle scripts) for experimenting with Spring on a Windows machine. |
Ada, Akka, C++, COBOL, Dafny, Dart, Deno, Docker, Erlang, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.
This project depends on the following external software for the Microsoft Windows platform:
- Apache Maven 3.9 (requires Java 8+) (release notes)
- Git 2.47 (release notes)
- Gradle 8.11 (requires Java 8+) (release notes)
- Temurin OpenJDK 17 LTS (release notes, bug fixes)
☛ Maven packages
We present the Maven package dependencies in documentPACKAGES.md
.
Optionally one may also install the following software:
- ConEmu 2023 (release notes)
- Spring Boot CLI 3
- Temurin OpenJDK 21 LTS (release notes, bug fixes, Java 21 API)
- Visual Studio Code 1.95 (release notes)
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\
as the installation directory for optional software tools (in reference to the/opt/
directory on Unix).
For instance our development environment looks as follows (December 2024) 1:
C:\opt\apache-maven\ ( 10 MB) C:\opt\ConEmu\ ( 26 MB) C:\opt\Git\ (367 MB) C:\opt\gradle\ (135 MB) C:\opt\jdk-temurin-17.0.13_11\ (301 MB) C:\opt\jdk-temurin-21.0.5_11\ (326 MB) C:\opt\spring-cli\ ( 6 MB) C:\opt\VSCode\ (341 MB)
🔎 Git for Windows provides a Bash emulation used to run
git
from the command line (as well as over 250 Unix commands likeawk
,diff
,file
,grep
,more
,mv
,rmdir
,sed
andwc
).
Directory structure ▴
This project is organized as follows:
docs\ examples\{README.md, demo, gs-rest-service, ..} PACKAGES.md README.md RESOURCES.md setenv.bat
where
- directory
docs\
contains Spring related documents. - directory
examples\
contains Spring code examples (see fileexamples\README.md
). - file
PACKAGES.md
presents the Maven packages our projects depend on. - file
README.md
is the Markdown document for this page. - file
RESOURCES.md
is the Markdown document presenting external resources. - file
setenv.bat
is the batch command for setting up our environment.
setenv.bat
2
We execute command setenv.bat
once to setup our development environment; it makes external tools such as gradle.bat
, git.exe
and sh.exe
directly available from the command prompt.
> setenv -verbose Tool versions: javac 17.0.13, java 17.0.13, Spring CLI v3.4.0, gradle 8.11.1, mvn 3.9.9, git 2.47.1, diff 3.10, bash 5.2.37(1) Tool paths: C:\opt\jdk-temurin-17.0.13_11\bin\javac.exe C:\opt\jdk-temurin-17.0.13_11\bin\java.exe C:\opt\spring-cli\bin\spring.bat C:\opt\gradle\bin\gradle.bat C:\opt\apache-maven\bin\mvn.cmd C:\opt\Git\bin\git.exe C:\opt\Git\usr\bin\diff.exe C:\opt\Git\bin\bash.exe Environment variables: "GIT_HOME=C:\opt\Git" "GRADLE_HOME=C:\opt\gradle" "JAVA_HOME=C:\opt\jdk-temurin-17.0.13_11" "JAVA11_HOME=C:\opt\jdk-temurin-11.0.23_9" "JAVA17_HOME=C:\opt\jdk-temurin-17.0.13_11" "JAVA21_HOME=C:\opt\jdk-temurin-21.0.5_11" "MAVEN_HOME=C:\opt\apache-maven" "PYTHON_HOME=C:\opt\Python-3.11.1" "SPRING_HOME=C:\opt\spring-cli" > where gradle mvn sh C:\opt\gradle\bin\gradle.bat C:\opt\apache-maven\bin\mvn C:\opt\apache-maven\bin\mvn.cmd C:\opt\Git\bin\sh.exe C:\opt\Git\usr\bin\sh.exe
🔎 Subcommand
help
prints the following help message :> setenv help Usage: setenv { <option> | <subcommand> } Options: -bash start Git bash shell instead of Windows command prompt -debug print commands executed by this script -verbose print progress messages Subcommands: help print this help message
Footnotes ▴
[1] Downloads ↩
- In our case we downloaded the following installation files (see section 1):
-
apache-maven-3.9.9-bin.zip ( 10 MB) ConEmuPack.230724.7z ( 5 MB) gradle-8.11.1-bin.zip (110 MB) OpenJDK17U-jdk_x64_windows_hotspot_17.0.13_11.zip (176 MB) OpenJDK21U-jdk_x64_windows_hotspot_21.0.5_11.zip (191 MB) PortableGit-2.47.1-64-bit.7z.exe ( 55 MB) spring-boot-cli-3.4.0-bin.zip ( 5 MB) VSCode-win32-x64-1.95.3.zip (131 MB)
[2] setenv.bat
usage ↩
-
Batch file
setenv.bat
has specific environment variables set that enable us to use command-line developer tools more easily. - It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
-
For instance we can quickly check that the two scripts
Launch-VsDevShell.ps1
andVsDevCmd.bat
are indeed available in our Visual Studio 2019 installation :> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev* C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
-
Concretely, in our GitHub projects which depend on Visual Studio (e.g.
michelou/cpp-examples
),setenv.bat
does invokeVsDevCmd.bat
(resp.vcvarall.bat
for older Visual Studio versions) to setup the Visual Studio tools on the command prompt.