> 文档中心 > SpringBoot总结1

SpringBoot总结1

文章目录

  • 前言
  • 一、SpringBoot是什么?
  • 二、使用步骤
    • 1.加入依赖
  • 三.常见的一些注解

前言

开卷中…


提示:以下是本篇文章正文内容,下面案例可供参考

一、SpringBoot是什么?

简化Spring中的配置文件

二、使用步骤

1.加入依赖

代码如下(示例):

<dependencies>    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId>    </dependency></dependencies>

三.常见的一些注解

  1. @RestController:相当于@Controller+@ResponseBody
  2. @RequestMapping:接受请求的url
  3. @EnableAutoConfiguration:告知springboot根据您添加的jar依赖来进行自动装配
  4. @Configuration:放在类上,表示java类是配置类
  5. @ComponentScan:包的扫描器
  6. @SpringBootApplication:是@EnableAtuoConfiguration+@ComponentScan+@Configuration的 组合
  7. @Import:用于导入其他的配置类
  8. @ImportResource:用来加载XML配置文件

开发者涨薪指南 SpringBoot总结1 48位大咖的思考法则、工作方式、逻辑体系松山湖网站