framework-web:spring:creation

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
framework-web:spring:creation [2019/01/22 01:38] – créée jcheronframework-web:spring:creation [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1
Ligne 16: Ligne 16:
  
  
-===== Spring MVC controller =====+===== Configuration =====
  
-Avec Spring MVC, un contrôleur comporte l'annotation **[[https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-controller|@Controller]]**+Configurer le path par défaut de l'application dans **src/main/resources/application.properties**
-Il reçoit les requêtes Http en réponses aux RequestMappings définis grâce aux annotations  et fournit une réponse Http +
- +
-<sxh java> +
- +
-@Controller +
-public class HelloController { +
- +
- @GetMapping("/hello"+
- public @ResponseBody String index() { +
- return "Hello world!"; +
-+
-}+
  
 +<sxh bash;gutter:false>
 +server.servlet.context-path=/demo
 </sxh> </sxh>
  
Ligne 41: Ligne 31:
 ===== Ressources ===== ===== Ressources =====
   * [[https://start.spring.io|SPRING INITIALIZR]]   * [[https://start.spring.io|SPRING INITIALIZR]]
-  * [[http://www.baeldung.com/spring-requestmapping|RequestMapping annotation]]+
  
  
  • framework-web/spring/creation.1548117490.txt.gz
  • Dernière modification : il y a 6 ans
  • (modification externe)