WARNING: This application intentionally uses deprecated technologies and patterns for educational purposes. DO NOT USE IN PRODUCTION.
A multi-module Java 8 calculator application built with intentionally deprecated versions of:
- Spring Boot 2.3.12 (deprecated, but Java 8 compatible)
- Lombok 1.18.12 (older version)
- Hibernate 5.4.32 (older version)
- Gradle 6.9.4 (older version)
gradle-calculator/
βββ addition-module/ # Addition operations service
βββ subtraction-module/ # Subtraction operations service
βββ calculator-core/ # Main application with REST API & database
βββ tests/ # Integration and unit tests
βββ build.gradle # Root Gradle configuration
This application intentionally demonstrates BAD PRACTICES for educational purposes:
- β Field injection with
@Autowired(instead of constructor injection) - β Old-style
@SpringBootApplicationconfiguration - β Manual component scanning
- β Deprecated session management
- β Old Hibernate annotations
- β Manual entity-to-DTO mapping (instead of MapStruct)
- β Raw JPQL queries
- β Old-style repository patterns
- β Manual validation (instead of Bean Validation)
- β Old HTTP servlet patterns
- β Deprecated ResponseEntity usage
- β Manual error handling
- β Manual test setup (instead of
@MockBean) - β Old JUnit patterns
- β Manual MockMvc configuration
- Java 8 (specifically required)
- Gradle 6.9.4 (configured via wrapper)
# Build all modules using wrapper (includes tests)
./gradlew build
# Run the application using wrapper
./gradlew :calculator-core:bootRun
# Run tests only
./gradlew :tests:test
# Or use the provided script
./run-app.sh
# Test the API (in another terminal)
./test-api.sh- Application: http://localhost:8080
- H2 Console: http://localhost:8080/h2-console
- Health Check: http://localhost:8080/api/calculator/health
# Perform calculation
POST /api/calculator/calculate
Content-Type: application/json
{
"firstOperand": 10.5,
"secondOperand": 5.3,
"operation": "addition",
"userSession": "optional-session-id"
}# Direct addition (deprecated)
GET /api/calculator/add?a=10&b=5# Get calculation history
GET /api/calculator/history?session=your-session&limit=10Uses H2 in-memory database with deprecated configuration:
- URL:
jdbc:h2:mem:calculatordb - Username:
sa - Password: (empty)
This application is designed for Java 8 and uses deprecated libraries:
| Component | Version | Status |
|---|---|---|
| Java | 8 | |
| Spring Boot | 2.3.12 | |
| Lombok | 1.18.12 | |
| Hibernate | 5.4.32 | |
| Gradle | 6.9.4 |
This project demonstrates:
- Legacy Spring Boot patterns from 2020-2021
- Multi-module Gradle setup with older versions
- Deprecated Hibernate usage patterns
- Old-style REST API development
- Legacy testing approaches
To modernize this application:
- Upgrade to Java 17+
- Use Spring Boot 3.x
- Replace field injection with constructor injection
- Use Bean Validation instead of manual validation
- Implement proper error handling
- Use MapStruct for entity mapping
- Upgrade testing patterns with modern annotations
# Health check
curl http://localhost:8080/api/calculator/health
# Simple addition
curl "http://localhost:8080/api/calculator/add?a=10&b=5"
# Full calculation
curl -X POST http://localhost:8080/api/calculator/calculate \
-H "Content-Type: application/json" \
-d '{"firstOperand":15.5,"secondOperand":4.3,"operation":"subtraction"}'Remember: This is an educational example of deprecated patterns. Use modern Spring Boot practices in real applications! π