Skip to content

Latest commit

 

History

History
96 lines (74 loc) · 3.07 KB

File metadata and controls

96 lines (74 loc) · 3.07 KB

Car Dealership

Car Dealership is a Java 17 console application that uses Spring XML bean configuration to let a user choose a car type and, where applicable, a tyre configuration.

GitHub Metadata

  • Suggested repository description: Java 17 Spring console app for selecting dealership car types and tyre configurations using XML-based dependency injection.
  • Suggested topics: java, java-17, spring-framework, spring, maven, xml-configuration, dependency-injection, junit5, oop, console-application, car-dealership, learning-project, portfolio-project

Tech Stack

  • Java 17
  • Maven
  • Spring Framework XML configuration
  • JUnit 5

Project Overview

The application models a simple dealership selection flow:

  • FamilyCar, SportsCar, and Truck implement the Car interface.
  • NormalTyre, SportsTyre, and HeavyTyre implement the Tyre interface.
  • CarSelectionWorkflow manages the full console interaction and validation.
  • applicationContext.xml wires the available car and tyre combinations as Spring beans.

Current Flow

  1. The application starts in CarDealershipApplication.
  2. Spring loads applicationContext.xml.
  3. The user enters their name.
  4. The user selects a car type: family car, sports car, or truck.
  5. If the car supports multiple tyre options, the user selects the tyre type.
  6. The application resolves the matching Spring bean.
  7. The selected car stores the owner name.
  8. The application prints the final ownership summary.

Flow Diagram

flowchart TD
    A["Start: CarDealershipApplication.main()"] --> B["Load Spring XML context<br/>applicationContext.xml"]
    B --> C["Prompt for owner name"]
    C --> D["Show car selection menu"]
    D --> E{"Car choice"}
    E -->|"1"| F["Show family car tyre menu"]
    E -->|"2"| G["Show sports car tyre menu"]
    E -->|"3"| H["Load truck bean"]
    E -->|"Invalid"| I["Show invalid choice and retry"]
    I --> D
    F --> J["Load familyCarNormalTyre or familyCarSportsTyre"]
    G --> K["Load sportsCarSportsTyre or sportsCarHeavyTyre"]
    H --> L["Set owner name"]
    J --> L
    K --> L
    L --> M["Print ownership summary"]
Loading

How To Run

mvn test
mvn package
java -jar target/car-dealership-0.0.1-SNAPSHOT.jar

If you prefer the Maven Wrapper, use mvnw.cmd on Windows or ./mvnw on Unix-like systems.

Sample Output

Welcome to the Car Dealership Application
Please enter your name:
Please select your car of choice:
1. Family car
2. Sports car
3. Truck
Please select the tyre type for the sports car:
1. Sports tyre
2. Heavy tyre
Bipin owns a sports car with heavy tyre

Known Limitations

  • The application is console-based and does not expose a REST API.
  • There is no persistence, billing, or inventory management.
  • The project is focused on Spring XML bean wiring and simple workflow handling.

Why This Repo Exists

This repository is intended as a learning and portfolio project that shows:

  • interface-based design
  • constructor and setter injection with Spring XML
  • console workflow handling
  • automated tests for bean wiring and user flow