This is a project that utilizes Maven as the build tool. This README file provides an overview of how to build, deploy, and develop the project. Spring boot offer a lot of features out of the box. It has a lot of libraries that can be used to build a production ready application. It is all about conventions when using it. It also have enterprise based community that depends on it. It offers MVC with dependency injection and inversion of control. It also offers a lot of features like security, caching, and many more.
But building a project from scratch is not an easy task. It requires a lot of knowledge and experience to build a production ready application. And Java is being a Java. Too many plugins and dependencies required to run a basic application. This requires a lot of resources to run. And also the garbage collector is not that good. It requires a lot of memory to run a basic application. But this can be solved by not using monolithic application. We can use microservices to solve this problem. Better resource management and set of tools and reporting applications to administrate and monitor the application.
To build the project, follow these steps:
-
Ensure that Maven is installed on your machine.
-
Clone the project repository to your local machine.
-
Navigate to the project root directory.
-
Open a terminal and run the following command: In Windows. Open POSH and run the following command:
./mvnw.cmd clean install
In Linux. Open a terminal and run the following command:
./mvnw clean install
This command will download all the project dependencies, compile the source code, and generate the output artifact. The artifact will be located in the
target
directory. The compiler output is in jar format. The name of the artifact will be in the following format:<artifactId>-<version>.jar
For example
target/challenge-0.0.1-SNAPSHOT.jar
. -
The generated output artifact will be located in the
target
directory.
To run the project locally. Use the following command
In Windows. Open POSH and run the following command:
./mvnw.cmd spring-boot:run
In Linux. Open a terminal and run the following command:
./mvnw spring-boot:run
Any modification on the source file will trigger the devtools that is installed on the pom.xml and will hot-reload the application.
The same thing can be applied with docker-compose. The following command will build and run the project with hot-reload enabled. Make sure docker and docker-compose are both installed in your local machine.
docker-compose up devel
To run the project using Docker Compose, follow these steps:
- Ensure that Docker and Docker Compose are installed on your machine.
- Run the following command
docker-compose pull
docker compose up maven-build
docker compose up prod
To develop the project, follow these steps:
- Ensure that you have the following tools installed on your machine:
- JDK (Java Development Kit) version 17 LTS or later
- Maven 3 or later
- An IDE (Integrated Development Environment) of your choice (e.g. Eclipse, IntelliJ IDEA, NetBeans).
my current choice is VSCode. To use in VSCode, add the following json file in
.vscode/settings.json
for better IDE experienceTo test endpoints. Install the following extension in VSCode{ "java.compile.nullAnalysis.mode": "automatic", "editor.formatOnSave": true, "editor.formatOnSaveMode": "modifications", "java.format.settings.profile": "java-edicom-eclipse-formatter-v2.xmal", "editor.codeActionsOnSave": { "source.organizeImports": true }, "java.eclipse.downloadSources": true, "java.maven.downloadSources": true, "java.configuration.updateBuildConfiguration": "interactive" }
REST Client
### Towers endpoint
GET http://localhost:8080/challenge/towers
### Health check endpoint
GET http://localhost:8080/health-check
Please refer to the following http://localhost:8080/swagger-ui/index.html for more information
The following endpoints are available for the bonus part of the challenge
### I would like to search for a tower using geo coordinates and radius. To do that run the following
GET http://localhost:8080/challenge/towers?latitude=37.469610248472584&longitude=-77.25050725083281&radius=100
You can use any of the following params to query any data listed in Tower.java
static String[] FIELDS = {
"tower_id",
"operator",
"address",
"height",
"tower_type",
"latitude",
"longitude",
"technology"
};
This README file has provided an overview of how to build, deploy, and develop the project. For more information, refer to the project documentation or contact the project team.