SpringBoot 的注解详细介绍

本文介绍了Spring Boot中核心注解的功能与用法,包括@SpringBootApplication、@RestController和@RequestMapping。详细解释了这些注解如何简化Spring应用的配置与开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

一、@SpringBootApplication 

下面介绍这三个注解:

二、@RestController

三、@RequestMapping


一、@SpringBootApplication 

这个注解主要是集成了

@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
 

这三个注解。

下面介绍这三个注解:

  1. @SpringBootConfiguration 这个注解主要是集成了 Spring 3.0以后的 @Configuration这个注解,代替xml文件中的bean
  2. @EnableAutoConfiguration 这个注解主要是集成了@AutoConfigurationPackage和@Import这两个注解,作用是自动加载jar的默认配置。
  3. @ComponentScan  作用是扫描。代替了以前的<context:component-scan>

二、@RestController

 这个注解集成了@ResponseBody@Controller这两个注解。

三、@RequestMapping

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值