一, Spring Boot 2.x 环境依赖,搭建基础架构

1.Spring Boot介绍


Spring Boot并不是一项新的技术,而是Spring的一个新项目。其目的是帮助开发人员更加快速的使用Spring的组件和服务,只需很简单的步骤便能创建一个Spring应用程序。Spring Boot特点就是习惯优于配置,一个字<快>,不需要很多繁杂的XML配置,大大提高了开发效率。


2.环境依赖


JDK1.8
Maven2.x
3.参考文档


Spring Boot GitHub:https://github.com/spring-projects/spring-boot
Spring Boot Official Document:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
Maven:https://www.imooc.com/learn/443
4.手工快速创建Spring Boot WEB应用


4.1官方文档:https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-using-the-default-package
4.2 手动创建指导:http://spring.io/guides/gs/rest-service/
4.3 新建maven工程,选择“Createa simple project”,artifactId项目名“pw_boot”,groupId包名cn.pw818.boot
4.4 POM文件


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


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
4.5 创建启动类


@SpringBootApplication
public class BaseSpringApplication
{
public static void main(String[] args)
{
SpringApplication.run(BaseSpringApplication.class, args);
}
}
4.6 创建测试类


@RestController
@RequestMapping("/user")
public class UserController
{
@GetMapping("/hello")
public Object helloWorld()
{
return "Hello World!";
}
}
地址:localhost:8080/user/hello



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值