1. 程式人生 > >springBoot(2)---hello word

springBoot(2)---hello word

world pom center boot code version 配置 text 項目

springBoot---hello world

學習springBoot,大家都習慣從hello world,上篇主要是通過一個小案例,來整體理解springBoot的運行思路。對springBoot有個宏觀認識。這篇開始真正學習springboot

Hello World

1. pom.xml文件

1.1. 設置spring boot的parent

   <parent>
        <groupId>org.springframework.boot</groupId>
        <
artifactId>spring-boot-starter-parent</artifactId> <version>1.5.2.RELEASE</version> </parent>

說明:Spring boot的項目必須要將parent設置為spring boot的parent,該parent包含了大量默認的配置,大大簡化了我們的開發。

1.2導入spring boot的web支持

       <dependency>
            <groupId
>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId>
</dependency>

1.3 添加Spring boot的插件

       <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId
>spring-boot-maven-plugin</artifactId> </plugin>

springBoot(2)---hello word