@Import、@ImportSource、@PropertySource、

spring导入bean的方式有三种:
Annotation-based configuration:
Java-based configuration:
XML-based configuration:


annotationfunctional
@Import导入java配置
@ImportSource导入xml配置
@PropertySource(value={“classpath:xxx.properties”})导入配置变量

org.springframework.context.annotation.Import

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Import {
	Class<?>[] value();
}

@Import的用法主要包括:
1、直接填 class数组 / 单个class
2、ImportSelector方式
3、ImportBeanDefinitionRegistrar方式


1、直接填 class数组 / 单个class

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({ZipkinServerConfiguration.class, BraveConfiguration.class, ZipkinQueryApiV1.class, ZipkinHttpCollector.class})
public @interface EnableZipkinServer {

}
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import(EnableDiscoveryClientImportSelector.class)
public @interface EnableDiscoveryClient {
	/**
	 * If true, the ServiceRegistry will automatically register the local server.
	 */
	boolean autoRegister() default true;
}
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@EnableDiscoveryClient
public @interface EnableEurekaClient {

}

2、ImportSelector方式

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({TransactionManagementConfigurationSelector.class})
public @interface EnableTransactionManagement {
    boolean proxyTargetClass() default false;

    AdviceMode mode() default AdviceMode.PROXY;

    int order() default 2147483647;
}

3、ImportBeanDefinitionRegistrar方式


@SpringBootApplication
@EnableEurekaClient
@EnableZipkinServer
@EnableDiscoveryClient
public class Test_App {
  public static void main(String[] args) {
   SpringApplication.run(Test_App.class, args);
  }
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Advanced Data Import VCL is a component suite for Borland Delphi and C++ Builder that allows you to import data from files of the most popular data formats to the database. You can import data from MS Excel, MS Access, DBF, XML, TXT, CSV, ODF and HTML. There will be no need to waste your time on tiresome data conversion - Advanced Data Import will do the task quickly, irrespective of the source data format. Key Features Data import from the most popular data formats: MS Excel 97-2007, MS Access, DBF, XML, TXT, CSV, OpenDocument format (ODF) and HTML Import of Unicode data (UTF-8, UTF-16/UCS-2, UTF-32/UCS-4). Automatic detection and manually preset text encoding for imported data Powerful component and property editors, which allow to set many import parameters at the design-time easily High productivity even on slow computers Adjustable parameters for each type of import 100% native Delphi code for MS Excel 97, DBF, TXT, CSV - no additional libraries or programs needed for the components to work. OLE, DDE, BDE etc not required either Detailed help system and a demo application for a quicker mastering of the product Delphi 5-7, 2005-2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6 and C++ Builder 5-6, 2006-2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6,XE7 support 安装步骤: I. Full Source Version 1. Uninstall previously installed version of EMS Advanced Data Import Component Suite from Delphi/C++Builder IDE: - Use the "Component\Install Packages..." menu item to open the "Packages" dialog box. - Find EMS Advanced Data Export package in the list and delete it by clicking "Remove". - Confirm deletion by pressing "OK". - Remove previously compiled packages (if any) QImport3RT_<IDE code>.BPL and QImport3DT_<IDE code>.BPL from your hard disk. 2. Build Run-Time Package: - Use the "File\Open Project" menu item to open QImport3RT_<IDE code> package. - Use the "View\Project Manager" menu item to open "Project Manager". - Search for QImport3RT_<IDE code> package in "Project Manager". - Double-click the package to select it. - Use the "Run\Build QImport3RT_<IDE code>" menu item to build the package. 3. Install Design-Time Package: - Use the "File\Open Project" menu item to open QImport3DT_<IDE code> package. - Use the "View\Project Manager" menu item to open "Project Manager". - Search for QImport3DT_<IDE code> package in "Project Manager". - Double-click the package to select it. - Use the "Run\Build QImport3DT_<IDE code>" menu item to build the package. - Right-click the package and select "Install" from the context menu. 注意事项: 本人在XE6上Build QImport3RT_<IDE code>时出现错误提示,原来是少了一个var变量声明,添加一个就可以了,变量声明可以在同一个pas文件搜索到有一处被注释掉了,复制过来就可以了。为了保持原版,我没有修改上传的压缩包。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值