The SmartStock360 Spring Boot backend is the central orchestration layer of the platform. It exposes a REST API that serves the product catalog from MySQL and transparently proxies demand-prediction requests to the Python FastAPI AI service — so frontend clients only ever talk to a single backend host on portDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JoseOlivares19/Proyecto-PC3-JavaScript-Avanzado/llms.txt
Use this file to discover all available pages before exploring further.
8080.
What the Service Does
The Spring Boot service is responsible for two core concerns:- Product catalog management — reads the
productotable from MySQL via JPA/Hibernate and returns all records through aGET /api/productosendpoint. - AI prediction proxy — accepts a JSON payload at
POST /api/productos/predict, forwards it unchanged to the Python FastAPI service running athttp://127.0.0.1:8001/predict/smart-stock, and streams the AI response back to the caller.
Prerequisites
Before starting, make sure the following tools are installed and available on yourPATH:
Java 21
The service targets Java 21 (LTS). Check your version with
java -version.Maven 3.9+
The project ships with the Maven Wrapper (
mvnw), so a system Maven is optional but recommended.A running MySQL 8+ instance and a running Python FastAPI AI service are also required before the application will function fully. See Database Configuration and the Python setup guide for details.
Dependencies
Thepom.xml declares the following key dependencies under the spring-boot-starter-parent BOM at version 4.1.0:
| Dependency | Purpose |
|---|---|
spring-boot-starter-webmvc | Embedded Tomcat + Spring MVC for REST endpoints |
spring-boot-starter-data-jpa | JPA/Hibernate + Spring Data repositories |
mysql-connector-j | MySQL JDBC driver (runtime scope) |
lombok | Boilerplate reduction (@Data, getters/setters) |
Building and Running
Navigate to the project directory
All Maven commands must be run from inside the
smartstock directory, where pom.xml lives.Build the project
Run the full build lifecycle to compile sources, process annotations (Lombok), and package the JAR.The first run downloads dependencies from Maven Central; subsequent runs use the local cache.
Start the application
Launch the embedded Tomcat server. The application listens on port 8080 by default.You should see a Spring Boot banner followed by a line similar to:
Project Structure
The source tree follows standard Spring Boot package-by-layer conventions:Application Entry Point
The application boots through the standard@SpringBootApplication entry point, which triggers component scanning, auto-configuration, and the embedded Tomcat startup:
CORS Configuration
TheProductoController is annotated with @CrossOrigin(origins = "*"), which instructs Spring MVC to include permissive CORS response headers for every request to /api/productos: