This project is a Spring Boot application that provides a web server with REST and WebSocket endpoints, configured with Jersey and Jetty respectively, and uses dependency injection to manage a shared component across the application.
- Parent: Contains configuration and version variables.
- Server: Implements a server with basic REST endpoints and WebSocket using Jakarta API.
- Spring: Spring Boot wrapper for the server module. It allows deploying the application to a pre-configured server using
mvn spring-boot:run
.
- Java Development Kit (JDK) 17 - Download and install the JDK.
- Apache Maven - Download and install the Maven build tool.
-
Download the project: Obtain the project folder. This folder should contain the
pom.xml
file and the project's source code. -
Open the terminal/command prompt: Navigate to the project folder
minimal-webserver-example
using the terminal (Mac/Linux) or command prompt (Windows). -
Build the project: Run the following command to build and package the project:
mvn clean package
. This command will download the required dependencies, compile the project, and package it into an executable JAR file. The final JAR file will be located in the directoryspring/target
, and its name will bespring-1.0-SNAPSHOT.jar
. -
Run the application: Execute the following command:
java -jar spring/target/spring-1.0-SNAPSHOT.jar
. This will start the Spring Boot application, and it will be accessible locally. -
Access the application: You can now access the application's REST endpoints and WebSocket using your preferred tools or web browser, connecting to
http://localhost:8080/...
.