Spring模式注解 – @Component"派生"注解
- @Repository --> 数据仓储模式注解
- @Component --> 通用组件模式注解 – 元注解
- @Service --> 服务模式注解
- @Controller --> Web控制器模式注解
- @Configuration --> 配置类模式注解
装配注解
- @ImportResource --> 替换XML元素,导入XML配置文件
- @Import --> 限定@Autowired依赖注入范围
- @ComponentScan --> 扫描指定package下标注Spring模式注解的类。
依赖注入注解
- @Autowired --> Bean依赖注入,支持多种依赖查找方式
- @Qualifier --> 细粒度的@Autowired依赖查找
- @Resource <-- java注解–> Bean依赖注入,仅支持名称依赖查找方式
Bean定义注解
-
@Bean --> 替换XML元素
-
@DependsOn --> 替换XML元素
-
@Lazy --> 替换XML元素
-
@Primary --> 替换XML元素
-
@Role --> 替换XML元素
-
@Lookup --> 替换XML元素
Spring条件注解
- @Profile --> 配置化条件装配
- @Conditional --> 编程条件装配
配置属性注解
- @PropertySource --> 配置属性抽象PropertySource注解
- @PropertySources --> @PropertySource集合注解
生命周期回调注解
- @PostConstruct --> 替换XML元素
<bean init-method="...">或InitializingBean - @PreDestory --> 替换XML元素
<bean destory-method="...">或DisposableBean
注解属性注解
- @AliasFor --> 别名注解属性,实现复用的目的。
性能注解
- @Indexed --> 提升Spring模式注解的扫描效率
本文标题:Spring注解驱动编程有哪些核心注解?
本文链接:https://blog.quwenai.cn/post/9221.html
版权声明:本文不使用任何协议授权,您可以任何形式自由转载或使用。






还没有评论,来说两句吧...