Welcome to the guide that will walk you through the process of setting up and using an enhanced E-commerce project built with Spring Boot! This latest version comes packed with exciting features, better structure, and fixes that will improve your development experience.
What’s New in This Version?
- Hibernate configuration added to automatically create database and tables upon project run.
- Service classes are now utilized to provide reusable services throughout the project.
- DAO classes interact seamlessly with the database.
- Various bugs fixed, including issues with product images and security.
- Supports both Eclipse and IntelliJ IDEs.
- Overall redesign for enhanced code reusability.
Disclaimer: Please note that this version is still under active development. Bugs related to endpoints and the shopping cart logic may still be present.
Quickstart Guide
Follow these steps to get your E-commerce project up and running:
- Clone the repository.
- Open the project in your preferred IDE (IntelliJ IDEA is recommended for this).
- Ensure that the project is recognized as a Maven project and configured as a Spring Boot application.
- For IntelliJ users, it’s essential to adjust the working directory to help Spring Boot locate the views. Find detailed instructions below.
- Navigate to the JtProject directory.
- Configure the database connection in the application.properties file. More information is available in the Database section.
- Run the project by executing the main function found in JtSpringProjectApplication.java.
- Open http://localhost:8080 in your browser!
- If you executed the basedata.sql script, you can log in with the following admin credentials:
- Username: admin
- Password: 123
- To log in as a normal user:
- Username: lisa
- Password: 765
Database Configuration
Use either MySQL or MariaDB for this project. To set up the database connection, configure the following properties in the application.properties file:
db.url=jdbc:mysql:[ip address of db]:[port of db]/ecommjava?createDatabaseIfNotExist=true
db.username=[username]
db.password=[password, if any]
Ensure that you use a user account with permissions (avoid using root directly).
If encountering the error java.lang.IllegalArgumentException: Could not resolve placeholder db.driver, consider adjusting your mysql-connector-java version in the pom.xml and reloading your Maven project. After successfully connecting your database, run the basedata.sql script to populate it with initial data.
Web Directories
The views are stored in src/main/webapp/views, but you may need to adjust your project working directory for Spring Boot to access them. Here’s how to do that in IntelliJ IDEA:
- Click on Edit Configurations… in the top-right corner.
- Select the JtSpringProjectApplication configuration.
- Change the Working directory option (if not shown, click on Modify Options to find it) to $MODULE_WORKING_DIR$.
- Click Apply and then OK.
Now when you run the project, the views should be accessible, and you’ll see the login page at http://localhost:8080!
Understanding the Project’s Workflow
Let’s dive a little deeper into the workflow by using an analogy: The E-commerce application can be likened to a well-coordinated restaurant.
- Controller: Think of this as the restaurant manager who takes orders (requests) from customers (users) and communicates with the kitchen (backend) to prepare dishes (data). For example, a login request translates to serving the login page.
- Models: These are like the ingredients that represent data and its relationships. Just as a chef understands the role of different ingredients in a dish, the application understands the data structures it uses.
- View: This is equivalent to the dining area where customers receive their meals (data). The aesthetic and comfortable arrangement help customers enjoy their experience.
Endpoints
Access various functionalities of the E-commerce application using the following endpoints:
- http://localhost:8080
- http://localhost:8080/register
- http://localhost:8080/admin/products
- http://localhost:8080/admin/customers
- http://localhost:8080/admin/categories
- http://localhost:8080/admin/dashboard
Troubleshooting Tips
If you encounter issues while working with this project, consider the following troubleshooting ideas:
- Ensure that all dependencies in your pom.xml are correctly configured.
- Double-check your MySQL or MariaDB connection details in the application.properties file.
- For any errors with database connectivity, verify that the database server is running and accessible.
- Try re-running the basedata.sql script if data does not appear as expected.
- Make sure your IDE has the project correctly imported as a Maven project.
- If the login page does not render, revisit the working directory setting in your IDE.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Reference Documentation & Guides
For further learning, check out the following resources:

