使用eclipse创建Spring Boot项目

使用eclipse创建Spring Boot项目

  • 环境介绍

      1.jdk1.8

      2.eclipse

      3.maven 3.5.0

  • 创建项目

    1. eclectic 左上角 file -> new -> maven project 出现下图默认就好,也可以根据自己需要进行修改 ,点next。

        使用eclipse创建Spring Boot项目

     2.点击next出现下图,选择ora.apache.maven.archetypes  maven-archetype-quickstart  1.1 然后点击next

      使用eclipse创建Spring Boot项目

     3.上图点击next后弹出下图,设置group id 和 artifact id 其他默认就好,然后点击finish

      使用eclipse创建Spring Boot项目

     4.项目创建完成后,在项目下面创建resources文件夹,然后在resources文件夹下面创建application.properties文件

      使用eclipse创建Spring Boot项目

    5.配置pom.xml

      使用eclipse创建Spring Boot项目

    6.创建启动类SpringBootDemoApplication和控制类Controller

      使用eclipse创建Spring Boot项目

    SpringBootDemoApplication类如下:

      使用eclipse创建Spring Boot项目

    

    Controller类如下:

      使用eclipse创建Spring Boot项目

     创建好后在SpringBootDemoApplication类里面右键run as 启动

使用eclipse创建Spring Boot项目

  启动完成后,在浏览器上输入localhost:8080/hello

  使用eclipse创建Spring Boot项目

    到此为止一个简单的spring boot 项目创建完成。