@RequestBody 写在方法上就代表这个方法不跳转页面,而是直接返回数据
@Service用于标注业务层组件
@Controller用于标注控制层组件
@Repository用于标注数据访问组件,即DAO组件
@Autowired, @Resource, @Inject 这三个都是用来注入bean的,
在接口前面标上@Autowired注释使得接口可以被容器注入
当接口存在两个实现类的时候必须使用@Qualifier指定哪个实现类,否则可以省略只写@Autowired
@value 通过@value可以将外部的值动态注入到Bean中
@Import用于指定的类的实例注入Spring IOC Container中
@SpringBootApplication:申明让Springboot自动给程序进行必要的配置,这个配置等同于@Configuration,@EnableAutoConfiguration和@ComponentScan三个配置
@ComponentScan:让spring Boot扫描到Configuration类并把它加入到程序上下文。
@Configuration :等同于spring的XML配置文件;使用Java代码可以检查类型安全
@EnableAutoConfiguration :自动配置。
@ComponentScan :组件扫描,可自动发现和装配一些Bean。
@Component可配合CommandLineRunner使用,在程序启动后执行一些基础任务。
@RestController用于标注控制层组件,是@ResponseBody和@Controller的集合
写了RestController就不用写@ResponseBody了,@Controller也是一样的
@RequestMapping 映射请求路径的 可以定义类上,也可以定义方法上
@GetMapping是一个组合注解,是@RequestMapping(method=RequestMethod.GET)的缩写;该注解讲HTTP Get映射到特定的处理方法上
@PostMapping是一个组合注解,是@RequestMapping(method=RequestMethod.GET)的缩写,