【SpringBoot-01】HelloWorld

Silicon Valley is still springboot tutorial P1 ~ P5

A, SpringBoot advantages:

  

Two, HelloWorld Demo building

1) New Maven Project (skip)

2) increase Maven dependence (refer to the official website springboot the spring QuickStart)

   

3) by @SpringBootApplication statement springboot application

    

4) define Controller

  @Controller : definitions Controller

  @ RequestMapping ( "/ the Hello") : Foreign provided URL path  

  @ResponseBody   :   Returns the value into a response body returned

   

5) direct the Run , and access http://127.0.0.1:8080/hello view the execution results

   

6) simplifies the deployment (POM new follows)

   

7)Maven Package打包成可执行JAR包(内含lib文件包含依赖的各种JAR包括嵌入式Tomcat包),通过java -jar 可执行jar包后,可直接访问http://127.0.0.1:8080/hello

  

 

Guess you like

Origin www.cnblogs.com/clarino/p/11980474.html