Skip to content

Java App : An inventory system with a RESTful API. This application demonstrates a layered architecture, dependency injection, and data persistence with Spring Data JPA.

Notifications You must be signed in to change notification settings

Litti8/Java-Inventory-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inventory REST API

This is a RESTful API for an inventory management system, developed as part of a personal Java challenge. It provides a set of endpoints for performing standard CRUD operations on inventory items.

Features

  • Create new items in the inventory.
  • Read all items or a single item by its ID.
  • Update an existing item's details.
  • Delete an item from the inventory.

Technologies Used

  • Spring Boot: The core framework for building the backend.
  • Spring Data JPA: For handling data persistence to a MySQL database.
  • Lombok: To reduce boilerplate code in model classes.
  • MySQL: The relational database used for data storage.
  • Logback: For robust and configurable application logging.

How to Run Locally

1. Database Setup

First, you need to configure your database connection in the src/main/resources/application.properties file.

# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/inventory_db?createDatabaseIfNotExist=true
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# JPA Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

# Server port
server.port=8080

# log pattern configuration
logging.pattern.console= [%thread] %-5level: %logger - %msg%n

# log level configuration
logging.level.root=INFO

Make sure to replace your_username and your_password with your actual MySQL credentials.

2. Build and Run the Application

Once the database is configured, you can run the application directly from your IDE by executing the EmployeeApplication.java main class. Alternatively, you can build and run the application using Maven. Navigate to the project directory and execute the following commands:

mvn spring-boot:run

This will start the application on http://localhost:8080/inventory-app.

3. API Endpoints

The following endpoints are available for managing inventory items:

  • GET /inventory-app/items: Get a list of all items.

  • POST /inventory-app/items: Add a new item.

  • GET /inventory-app/items/{id}: Get a specific item by its ID.

  • PUT /inventory-app/items/{id}: Update an existing item by its ID.

  • DELETE /inventory-app/items/{id}: Delete an item by its ID.

About

Java App : An inventory system with a RESTful API. This application demonstrates a layered architecture, dependency injection, and data persistence with Spring Data JPA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages