|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo01-Installation/A%1D-Code-Java)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">02 - Spring - Injection De Dépendances</h1></th>
|
|
|
<th width="200px"><h6 align="right">[Exo Suivant :fast_forward:](/Exo03-List/1%5D-Code-Java)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/Exo02-Injection-de-dependances/1%5D-Code-Java)<br/>Code Java</td>
|
|
|
<td align="center">[:two:](/Exo02-Injection-de-dependances/2%5D-XML)<br/>XML</td>
|
|
|
<td align="center">:white_check_mark:<br/>Configuration</td>
|
|
|
<td align="center">[:four:](/Exo02-Injection-de-dependances/4%5D-Spring-Boot)<br/>Spring Boot</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table>
|
|
|
|
|
|
***
|
|
|
|
|
|
# Modification de votre classe de configuration
|
|
|
Dans la classe `src\main\java\com\exo\SpringConfiguration.java` déclarez une méthode qui devra fabriquer un bean Adresse ayant comme propriétés votre adresse.
|
|
|
|
|
|
N'oubliez pas d'annoter votre méthode avec [@Bean](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Bean.html).
|
|
|
|
|
|
Liez-le à votre bean client via sa méthode set ou son constructeur.
|
|
|
|
|
|
# Test
|
|
|
Lancez l'application et regardez ce qui s'affiche.
|
|
|
|
|
|
En cas d'erreur lisez **attentivement** les messages Spring, n'hésitez pas à **scroller**.
|
|
|
|
|
|
***
|
|
|
|
|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo01-Installation/A%1D-Code-Java)</h6></th>
|
|
|
<th colspan="4" width="600px"><h1 align="center">02 - Spring - Injection De Dépendances</h1></th>
|
|
|
<th width="200px"><h6 align="right">[Exo Suivant :fast_forward:](/Exo03-List/1%5D-Code-Java)</h6></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td> </td>
|
|
|
<td align="center">[:one:](/Exo02-Injection-de-dependances/1%5D-Code-Java)<br/>Code Java</td>
|
|
|
<td align="center">[:two:](/Exo02-Injection-de-dependances/2%5D-XML)<br/>XML</td>
|
|
|
<td align="center">:white_check_mark:<br/>Configuration</td>
|
|
|
<td align="center">[:four:](/Exo02-Injection-de-dependances/4%5D-Spring-Boot)<br/>Spring Boot</td>
|
|
|
<td> </td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
<tr align="right">
|
|
|
<td colspan="6">
|
|
|
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tfoot>
|
|
|
</table> |