本文整理汇总了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(), ","));
}
示例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 — 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);
}
示例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 — 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);
}