eclipse创建springBoot项目


创建Spring Boot 工程

先在eclipse中安装spring -tool -suite插件,然后根据以下步骤可以创建
1、新建Spring Starter Project


5



2、Packaging 选择 jar

 

6



3、勾选Web 项

 

7



4、项目结构

 

8


 

启动项目


1、创建 HelloController.java

 

9

 

package com.example.demo; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/hello") public class HelloController { @RequestMapping("/sts") public String helloworld(){ return "使用spring-tool-suite插件"; } }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14


2、运行 DemoApplication.java文件 或者 右键项目 Run As -> Spring Boot App

 

10



3、打印输出:Started DemoApplication in 3.977 seconds (JVM running for 6.73) 说明项目启动成功。

 

11



4、访问网页

http://localhost:8080/hello/sts

 

12


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM