当前位置: 移动技术网 > IT编程>开发语言>Java > 从零开始学 Spring Boot

从零开始学 Spring Boot

2019年03月12日  | 移动技术网IT编程  | 我要评论

1、下载 spring-tool-suite

https://spring.io/tools3/sts/legacy

 

2、解压运行

sts-bundle\sts-3.9.7.release\sts.exe

 

3、新建工程

打开 dashboard,点击 create spring starter project

 

 

进入 new spring starter project,设置项目名称(name)、项目 maven 坐标(group、artifact),点击 next

 

 

进入 new spring starter project dependencies,选择项目依赖 jar 包

 

 

点击 finish,进入项目

 

 

4、hello world

新建 helloworld.java,输入如下代码:

 1 package com.example.demo;
 2 
 3 import org.springframework.web.bind.annotation.requestmapping;
 4 import org.springframework.web.bind.annotation.restcontroller;
 5 
 6 @restcontroller
 7 public class helloworld {
 8 
 9     @requestmapping("/")
10     public string hello() {
11         return "hello world!";
12     }
13     
14 }

 

项目结构如下

 

5、运行

选中 demoapplication.java,右键 run as -> spring boot app


 

浏览器输入:http://www.lhsxpumps.com/_localhost:8080/


 

ps: 本机 java jdk8

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网