A service can receive a dependency through its constructor before any framework is involved. An interface lets tests supply a small implementation, and the service can focus on its own rule. A repository similarly expresses an identity-based storage contract without requiring a database. These boundaries make a plain Java program easier to test.
Spring Boot creates and wires components; JPA maps entity state to persistent storage. Neither framework runs in this browser. You will use explicit constructor calls, an in-memory map and tentative state to practice injection, identity and rollback rules. The transaction model restores the original value when validation fails. It does not claim database isolation, durable commits, lazy loading or framework lifecycle behavior. Keep that distinction when you explain what a passing test proves.