This is a simple Spring Boot client-server application for PoC/demo upload of the files from client to server.
- Run a Java/Spring Boot/Tomcat server to accepts the incoming connections.
- Run a command-line client that uploads the specified file and exits.
- Edit
src/main/resources/application.properties
to configure artifact folder (file.upload-dir
) and port (server.port
, optional). - Start the server:
mvn spring-boot:run
- Download and install dependencies:
mvn clean install
- Run the client (upload a file):
SERVER_URL="http://localhost:8080" # Change if needed
CLASS_PATH="target/classes;target/dependency/httpclient-4.5.13.jar;target/dependency/httpcore-4.4.16.jar;target/dependency/httpmime-4.5.13.jar;target/dependency/commons-logging-1.2.jar"
CLIENT_CLASS="com.example.artifactuploaddemo.client.ArtifactUploadClient"
java -cp $CLASS_PATH $CLIENT_CLASS $SERVER_URL <filename_to_upload>
- Download and install dependencies:
mvn clean install
- Run the client (upload a file):
$serverUrl = "http://localhost:8080" # Change if needed
$classPath = "target/classes;target/dependency/httpclient-4.5.13.jar;target/dependency/httpcore-4.4.16.jar;target/dependency/httpmime-4.5.13.jar;target/dependency/commons-logging-1.2.jar"
$clientClass = "com.example.artifactuploaddemo.client.ArtifactUploadClient"
java.exe -cp $classPath $clientClass $serverUrl <filename_to_upload>
This section is generated automatically by Spring Initializr.
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Web
- Spring Boot DevTools
The following guides illustrate how to use some features concretely:
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
Due to Maven's design, elements are inherited from the parent POM to the project POM.
While most of the inheritance is fine, it also inherits unwanted elements like <license>
and <developers>
from the parent.
To prevent this, the project POM contains empty overrides for these elements.
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.