eclipse创建springboot项目的三种方法 – mousede的博客 – CSDN博客

eclipse创建springboot项目的三种方法

2018年07月30日 15:27:53
无敌mouse
阅读数:4361

方法一

安装STS插件

resize,m_fill,w_884,h_840#

resize,m_fill,w_1152,h_662#

安装插件导向窗口完成后,在eclipse右下角将会出现安装插件的进度,等插件安装完成后重启eclipse生效

新建spring boot项目

resize,m_fill,w_1152,h_862#

resize,m_fill,w_1022,h_994#

项目启动

resize,m_fill,w_1152,h_950#

方法二

1.创建Maven项目

resize,m_fill,w_1050,h_1000#

2.选择项目类型

resize,m_fill,w_1152,h_1038#

3.选择项目

resize,m_fill,w_1152,h_1038#

4.编写项目组和名称-finish即可

resize,m_fill,w_1152,h_1038#

5.修改pom.xml文件

<!– spring boot基本环境 –>

<parent>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-parent</artifactId>

    <version>2.0.2.RELEASE</version>

</parent>

resize,m_fill,w_1152,h_530#

6.pom.xml中添加依赖

<!–web应用基本环境配置 –>

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-web</artifactId>

</dependency>

resize,m_fill,w_1152,h_490#

7.pom.xml中添加编译插件

<build>

    <plugins>

    <!– spring-boot-maven-plugin插件就是打包spring boot应用的 –>

        <plugin>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-maven-plugin</artifactId>

        </plugin>

    </plugins

</build>

resize,m_fill,w_1152,h_590#

8.基础包和类

resize,m_fill,w_584,h_496#

9.创建resources文件夹和application.properties文件

resize,m_fill,w_1152,h_578#

10.App.java

package com.springboot.springbootDemo;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

public class App

{

    public static void main( String[] args )

    {

        SpringApplication.run(App.class, args);

    }

}

resize,m_fill,w_1152,h_536#

11.HelloController.java

package com.springboot.springbootDemo.controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

@RestController

@RequestMapping(“hello2”)

public class HelloController {

       @RequestMapping(“”)

       public String hello() {

              return “helloworld2”;

       }

}

resize,m_fill,w_1152,h_394#

12.启动项目

resize,m_fill,w_1152,h_994#

13.访问项目(低版本可能无法访问,2版本可用)

http://localhost:8012/hello2

resize,m_fill,w_1132,h_456#

方法三

访问http://start.spring.io/

resize,m_fill,w_1152,h_524#

点击Generate Project下载项目压缩包

解压后,使用eclipse,Import -> Existing Maven Projects -> Next ->选择解压后的文件夹-> Finsh,OK done!

Measure
Measure
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值