Documentation - Projet API REST: consulterClient
Ce document décrit les etapes de creation d'un projet Java Spring Boot qui expose une API REST
pour consulter un client via la methode `consulterClient`, definie dans l'interface IClientMetier.
1. Creation du projet :
- Outil : Spring Initializr (https://start.spring.io)
- Projet : Maven
- Langage : Java
- Dependances : Spring Web
2. Structure du projet :
- org.sid.entities : contient la classe Client
- org.sid.metier : contient l'interface IClientMetier
- org.sid.metier.impl : contient l'implementation de l'interface
- org.sid.web : contient le controleur REST
- org.sid : contient la classe principale
3. Classe `Client` :
- Attributs : id, nom, prenom, email
- Constructeurs + Getters/Setters
4. Interface `IClientMetier` :
- Methode a implementer : `Client consulterClient(Long codeClt);`
5. Classe `ClientMetierImpl` :
- Implemente `IClientMetier`
- Fournit une fausse reponse contenant un client fictif
6. Controleur REST `ClientRestController` :
- Endpoint : `/clients/{id}`
- Methode : GET
- Injecte `IClientMetier` et appelle `consulterClient`
7. Classe principale `ClientApiApplication` :
- Lance l'application Spring Boot
8. Test de l'API :
- URL : http://localhost:8080/clients/1
- Methode : GET
- Reponse JSON simulee avec un client fictif