SpringBoot注解集合
使用注解的优势:
1.采用纯java代码,不在需要配置繁杂的xml文件
2.在配置中也可享受面向对象带来的好处
3.减少复杂配置文件的同时亦能享受到springIoC容器提供的功能
@SpringBootApplication:申明让spring boot自动给程序进行必要的配置,这个配置等同于:@Configuration ,@EnableAutoConfiguration 和 @ComponentScan 三个配置。
@Bean:用@Bean标注方法等价于XML中配置的bean。相当于XML中的,放在方法的上面,而不是类,意思是产生一个bean,并交给spring管理。
@RequestMapping 和 @GetMapping @PostMapping 区别:
@GetMapping是一个组合注解,是@RequestMapping(method = RequestMethod.GET)的缩写。
@PostMapping是一个组合注解,是@RequestMapping(method = RequestMethod.POST)的缩写。
@AutoWired是byType的,类型都相同时,就需要使用@Qualifier明确指定使用那个具体的实现。因此,@Qualifier是byName的。
你为什么不努力。。