当前位置: 首页>>代码示例>>Java>>正文


Java ContextConfigurationAttributes.setLocations方法代码示例

本文整理汇总了Java中org.springframework.test.context.ContextConfigurationAttributes.setLocations方法的典型用法代码示例。如果您正苦于以下问题:Java ContextConfigurationAttributes.setLocations方法的具体用法?Java ContextConfigurationAttributes.setLocations怎么用?Java ContextConfigurationAttributes.setLocations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.test.context.ContextConfigurationAttributes的用法示例。


在下文中一共展示了ContextConfigurationAttributes.setLocations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processContextConfiguration

import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
	String className = "io.leopard.javahost.AutoUnitRunnable";
	try {
		Runnable runnable = (Runnable) Class.forName(className).newInstance();
		runnable.run();
	}
	catch (Exception e) {
		// System.err.println("init hosts error:" + e.toString());
		// e.printStackTrace();
	}
	String[] locations = new String[0];
	if (locations.length == 0) {
		locations = new ApplicationContextLocationImpl().get();
	}
	// files = ArrayUtil.insertFirst(files, "/leopard-test/annotation-config.xml");
	locations = StringUtils.addStringToArray(locations, "/leopard-test/annotation-config.xml");
	configAttributes.setLocations(locations);
	// System.err.println("processContextConfiguration:" + org.apache.commons.lang.StringUtils.join(configAttributes.getLocations(), ","));
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:21,代码来源:TestContextLoader.java

示例2: processContextConfiguration

import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
/**
 * For backwards compatibility with the {@link ContextLoader} SPI, the
 * default implementation simply delegates to {@link #processLocations(Class, String...)},
 * passing it the {@link ContextConfigurationAttributes#getDeclaringClass()
 * declaring class} and {@link ContextConfigurationAttributes#getLocations()
 * resource locations} retrieved from the supplied
 * {@link ContextConfigurationAttributes configuration attributes}. The
 * processed locations are then
 * {@link ContextConfigurationAttributes#setLocations(String[]) set} in
 * the supplied configuration attributes.
 * <p>Can be overridden in subclasses &mdash; for example, to process
 * annotated classes instead of resource locations.
 * @since 3.1
 * @see #processLocations(Class, String...)
 */
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
	String[] processedLocations = processLocations(configAttributes.getDeclaringClass(),
		configAttributes.getLocations());
	configAttributes.setLocations(processedLocations);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:22,代码来源:AbstractContextLoader.java

示例3: processContextConfiguration

import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
/**
 * For backwards compatibility with the {@link ContextLoader} SPI, the
 * default implementation simply delegates to {@link #processLocations(Class, String...)},
 * passing it the {@link ContextConfigurationAttributes#getDeclaringClass()
 * declaring class} and {@link ContextConfigurationAttributes#getLocations()
 * resource locations} retrieved from the supplied
 * {@link ContextConfigurationAttributes configuration attributes}. The
 * processed locations are then
 * {@link ContextConfigurationAttributes#setLocations(String[]) set} in
 * the supplied configuration attributes.
 * <p>Can be overridden in subclasses &mdash; for example, to process
 * annotated classes instead of resource locations.
 * @since 3.1
 * @see #processLocations(Class, String...)
 */
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
	String[] processedLocations = processLocations(configAttributes.getDeclaringClass(), configAttributes.getLocations());
	configAttributes.setLocations(processedLocations);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:AbstractContextLoader.java


注:本文中的org.springframework.test.context.ContextConfigurationAttributes.setLocations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。