SpringBoot学习笔记1(Spring相关)

一、Spring相关

(1).Spring相关注解

1.@configuration: 注解成功引起Spring容器的注意
2.@Aspect: 让Spring容器知道,这是一个AOP类
3.@Around: 是AOP的一种具体方式,简单地说它能对目标方法调用前和调用后进行处理
4.@within(@org.springframework.stereotype.Controller*): 可以理解为对所有使用@Controller注解的类进行AOP
5.@annotation(function): 对具有function参数对应的注解方法进行AOP
6.@Repository: 声明此类是一个数据库或其他NoSQL访问类
7.@RestController: 同Controller,用于REST服务
7.@Component: 声明此类是一个Spring管理的类,通常用于无法用上述注解的Spring管理类
8.@Configuration:声明此类是一个配置类,通常与注解@Bean配合使用
9.@Bean: 作用在方法上,声明该方法执行的返回结果是一个Spring容器管理的Bean
注: Spring负责实例化Bean,开发者可以提供一系列回调函数,用于进一步配置Bean,包括@PostConstruct注解和@PreDestory注解
10.@PreDestory: 在容器被销毁之前,调用被@ PreDestory注解的方法二、SpringBoot基础

猜你喜欢

转载自blog.csdn.net/affluent6/article/details/88870302
今日推荐