Spring注解之@Import
/**
* Indicates one or more {@link Configuration @Configuration} classes to import.
* 表示import 一个或多个class
* <p>Provides functionality equivalent to the {@code <import/>} element in Spring XML.
* 等同于Spring XML 中的 <import/>的作用
* Allows for importing {@code @Configuration} classes, {@link ImportSelector} and
* {@link ImportBeanDefinitionRegistrar} implementations, as well as regular component
* classes (as of 4.2; analogous to {@link AnnotationConfigApplicationContext#register}).
* 运行的值类型 @Configuration注解的类,@ImportSelector 和 ImportBeanDefinitionRegistrar的实现类
*
* <p>{@code @Bean} definitions declared in imported {@code @Configuration} classes should be
* accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired}
* injection. Either the bean itself can be autowired, or the configuration class instance
* declaring the bean can be autowired. The latter approach allows for explicit, IDE-friendly
* navigation between {@code @Configuration} class methods.
* @Bean声明定义的 @Configuration实现类 通过@Autowired注入的方式访问; 不管是通过autowired 实例化还是通过
* 配置配置类 实例化声明bean. 后一种方法显示通过IDEA友好在各个方法之间导航
* <p>May be declared at the class level or as a meta-annotation.
* 可以在类级别声明,也可以作为元注释
* <p>If XML or other non-{@code @Configuration} bean definition resources need to be
* imported, use the {@link ImportResource @ImportResource} annotation instead.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.0
* @see Configuration
* @see ImportSelector
* @see ImportResource
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Import { /**
* {@link Configuration}, {@link ImportSelector}, {@link ImportBeanDefinitionRegistrar}
* or regular component classes to import.
*/
Class<?>[] value(); }
Spring注解之@Import的更多相关文章
- 三、Spring注解之@Import
spring注解之@Import [1]@Import 参数value接收一个Class数组,将你传入的类以全类名作为id加入IOC容器中 比较简单,此处不做详细解释 [2]ImportSel ...
- spring注解之@Import注解的三种使用方式
目录 1.@Import注解须知 2.@Import的三种用法 3.@Import注解的三种使用方式总结 @ 1.@Import注解须知 1.@Import只能用在类上 ,@Import通过快速导入的 ...
- 【Spring注解驱动开发】使用@Import注解给容器中快速导入一个组件
写在前面 我们可以将一些bean组件交由Spring管理,并且Spring支持单实例bean和多实例bean.我们自己写的类,可以通过包扫描+标注注解(@Controller.@Servcie.@Re ...
- 【Spring注解驱动开发】在@Import注解中使用ImportSelector接口导入bean
写在前面 在上一篇关于Spring的@Import注解的文章<[Spring注解驱动开发]使用@Import注解给容器中快速导入一个组件>中,我们简单介绍了如何使用@Import注解给容器 ...
- 【Spring注解驱动开发】在@Import注解中使用ImportBeanDefinitionRegistrar向容器中注册bean
写在前面 在前面的文章中,我们学习了如何使用@Import注解向Spring容器中导入bean,可以使用@Import注解快速向容器中导入bean,小伙伴们可以参见<[Spring注解驱动开发] ...
- Spring注解
AccountController .java Java代码 1. /** 2. * 2010-1-23 3. */ 4. packag ...
- [转]Spring 注解总结
原文地址:http://blog.csdn.net/wangshfa/article/details/9712379 一 注解优点?注解解决了什么问题,为什么要使用注解? 二 注解的来龙去脉(历史) ...
- spring 注解简单使用
一.通用注解 1.项目结构: 2.新建Person类,注解@Component未指明id,则后期使用spring获取实例对象时使用默认id="person"方式获取或使用类方式获取 ...
- Spring 注解总结
声明:这是转载的.内容根据网上资料整理.相关链接:http://www.360doc.com/content/10/1118/16/2371584_70449913.shtmlhttp://www.i ...
随机推荐
- SPOJ 839 Optimal Marks(最小割的应用)
https://vjudge.net/problem/SPOJ-OPTM 题意: 给出一个无向图G,每个点 v 以一个有界非负整数 lv 作为标号,每条边e=(u,v)的权w定义为该边的两个端点的标号 ...
- c#四舍五入取整
Math.Round(3.45, 0, MidpointRounding.AwayFromZero) 上取整或下取整 Math.Ceiling(3.1)=4; Math.Floor(3.9)=3;
- 如何用R来定制个性化PPT
ReporteRs包可以创建word,ppt,html文档.它可以格式化R的输出:如可编辑的矢量图,复杂的表格报告功能,企业模板文档的重用(.docx和.pptx).它是一个很好的自动化报告工具,并且 ...
- python中常用的模块一
一,常用的模块 模块就是我们将装有特定功能的代码进行归类,从代码编写的单位来看我们的程序,从小到大的顺序: 一条代码<语句块,<代码块(函数,类)<模块我们所写的所有py文件都是模块 ...
- STL_map.插入
环境:Win7x64.vs08x86 1.类中这样声明:map<string, list<string>> FmapTagAttr; 2.插入数据时这样: list<st ...
- [转]fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突
来自--------------------- 原文:https://blog.csdn.net/qtbmp/article/details/7273191?utm_source=copy win7 ...
- Http请求处理流程 管道流程 MVC扩展HttpModule
HttpApplication 封装了管道处理请求的所有事件 HttpModule 对HttpApplication中事件的扩展 HttpHandler 处理程序 每个请求都要经过Handle ...
- 《剑指offer》第五十题(字符串中第一个只出现一次的字符)
// 面试题50(一):字符串中第一个只出现一次的字符 // 题目:在字符串中找出第一个只出现一次的字符.如输入"abaccdeff",则输出 // 'b'. #include & ...
- Codeforces 961E - Tufurama
961E - Tufurama 思路: 线段树或者分块 遍历 1 - n - 1,求 区间[i + 1, min(a[i], n)]大于等于 i 的个数,累加起来 线段树: #include<b ...
- NGUI实现UITexture的UV滚动
材质上使用的贴图: 效果:实现该纹理在屏幕上的滚动 代码: using System.Collections; using System.Collections.Generic; using Unit ...