springboot基础1

1.spring的优点:

1)依赖注入
2)面向切面编程

2.spring的缺点:

1)太多的xml配置文件

3.springboot特点:

解决了spring配置文件太多的问题,它有很多默认的配置,springboot其实是提供了一种快速使用spring的方式.

4.springBoot核心功能

1)起步依赖:将具有某种功能的坐标打包到一起
2)自动配置,该过程是spring自动完成的

5.SpringBoot快速入门
1)创建一个maven工程
2)添加springBoot的起步依赖

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

SpringBoot要集成SpringMVC进行Controller的开发,所以项目要导入web的启动依赖
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
</dependencies>

3)编写SpringBoot的引导类

@SpringBootApplication
public class MySpringBootApplication {
    public static void main(String[] args) {
        SpringApplication.run(MySpringBootApplication.class);
    }
}

4)Controller层的编写

@Controller
public class TestController {
    @RequestMapping("test")
    @ResponseBody
    public String test(){
        return "hello SpringBoot";
    }
}

6.SpringBoot热部署
1)添加依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>

2)修改idea的配置

在这里插入图片描述
3)然后 Shift+Ctrl+Alt+/,选择Registry
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值