A Web Service made with Spring Boot for Sorting Arbitrary Long Lists of Floating-point Numbers.
Three different sorting algorithms are available:
- Bubble Sort
- Merge Sort
- Quick Sort
- Java 21 or higher
- Maven 3.9.8
- Clone the repository
git clone https://github.com/hamexhanif/sortingapp.git
cd sortingapp- Compile the project
mvn clean packageBefore the first start, you need to create an SSL certificate:
keytool -genkey -alias sortingapp_cert -keyalg RSA -keystore certificate.p12 -storetype PKCS12 -validity 365 -dname "CN=Muhammad Hanif, O=Energy, O=Fraunhofer, L=Dresden, S=Saxony, C=DE"When prompted, enter a password and confirm the certificate details. The one used in the exsiting repository is thisisthepassword, configurable in application.properties
After the certificate certificate.p12 generated, put it in the src/main/resources directory.
mvn spring-boot:runThe service will then running at https://localhost:8100
All endpoints accept POST requests with a JSON array of floating-point numbers.
- URL:
/api/sort/bubblesort - Method: POST
- Example Request:
[5.5, 3.2, 1.1, 4.4]- URL:
/api/sort/mergesort - Method: POST
- Example Request:
[5.5, 3.2, 1.1, 4.4]- URL:
/api/sort/quicksort - Method: POST
- Example Request:
[5.5, 3.2, 1.1, 4.4]curl -k -X POST https://localhost:8100/api/sort/mergesort -H "Content-Type: application/json" -d "[5.5, 3.2, 1.1, 4.4]"Configuration settings are located in application.properties:
- Port: 8100
- HTTPS Configuration
- Logging Configuration
mvn testEnable debug mode to view the duration and a detailed breakdown of the sorting process. To do so, uncomment the # spring.profiles.active=debug line in the application.properties file or start the application with the following command:
mvn spring-boot:run -Dspring.profiles.active=debug