目录
7、@PathVariable、@RequestParam、@RequestAttribute
1、@Component、@Service、@Repository
(1) @Component 最普通的组件,可以被注入到spring容器进行管理。
一、项目配置注解
1、@SpringBootApplication
这是一个注解组合,包括了@SpringBootConfiguration、@EnableAutoConfiguration和@ComponentScan注解。
(1) @SpringBootConfiguration 继承自@Configuration,对于熟悉spring的开发者而言,此标注当当前类是配置类,并会将当前类内声明的一个或多个以@Bean注解标记的方法的实例纳入到spring容器中,并且实例名就是方法名。
(2)@EnableAutoConfiguration 这个注解就是springboot能自动进行配置的魔法所在。主要通过此注解,能将所有符合自动配置条件的bean的定义加载到spring容器中,比如根据spring-boot-starter-web,来判断你的项目是否需要添加webmvc和tomcat,就会自动的帮你配置web项