本文整理汇总了Java中org.unitils.spring.annotation.SpringApplicationContext类的典型用法代码示例。如果您正苦于以下问题:Java SpringApplicationContext类的具体用法?Java SpringApplicationContext怎么用?Java SpringApplicationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpringApplicationContext类属于org.unitils.spring.annotation包,在下文中一共展示了SpringApplicationContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkIfEverythingIsInPlace
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
* This method checks if the testclass contains a {@link SpringApplicationContext} and a {@link ConfigureProfile}.
*
* @param testClass
* @return boolean
*/
protected boolean checkIfEverythingIsInPlace(Class<?> testClass) {
if (!testClass.isAnnotationPresent(ConfigureProfile.class)) {
LOGGER.warn("The annotation 'ConfigureProfile' is not present.");
return false;
}
ConfigureProfile configProfile = testClass.getAnnotation(ConfigureProfile.class);
if (StringUtils.isEmpty(configProfile.value())) {
throw new UnitilsException("The name of the profile should be filled in.");
}
//type of configuration is ApplicationContext
if (configProfile.configuration().equals(TypeConfiguration.APPLICATIONCONTEXT)) {
if (!testClass.isAnnotationPresent(SpringApplicationContext.class)) {
throw new UnitilsException("The annotation 'SpringApplicationContext' is not present.");
}
} else {
//type of the configuration is the annotation Configuration.
if (StringUtils.isEmpty(configProfile.packageProfile())) {
throw new UnitilsException("You should fill in the name of the package of the profile.");
}
}
return true;
}
示例2: createMethod2
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod2(List<String> locations) {
createMethod2Called = true;
assertLenientEquals(asList("classpath:org/unitils/spring/services-config.xml"), locations);
createMethod2Called = true;
return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
示例3: setField
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
public void setField(ApplicationContext setter) {
this.setter = setter;
}
示例4: setField
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext({"classpath:org/unitils/spring/services-config.xml", "classpath:org/unitils/spring/services-config.xml"})
public void setField(ApplicationContext field) {
}
示例5: createMethod
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod() {
return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
示例6: createMethod1
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod1(List<String> locations) {
return null;
}
示例7: createMethod2
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod2(List<String> locations) {
return null;
}
示例8: createMethod1
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
@SpringApplicationContext
protected ApplicationContext createMethod1(List<String> locations) {
createMethod1Called = true;
return new ClassPathXmlApplicationContext("classpath:org/unitils/spring/services-config.xml");
}
示例9: ApplicationContextManager
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
* Creates a new instance, using the given {@link ApplicationContextFactory}. The given list of
* <code>BeanPostProcessor</code>s will be registered on all <code>ApplicationContext</code>s that are
* created.
*
* @param applicationContextFactory The factory for creating <code>ApplicationContext</code>s, not null.
*/
public ApplicationContextManager(ApplicationContextFactory applicationContextFactory) {
super(ApplicationContext.class, SpringApplicationContext.class);
this.applicationContextFactory = applicationContextFactory;
}
示例10: getAnnotationValues
import org.unitils.spring.annotation.SpringApplicationContext; //导入依赖的package包/类
/**
* Gets the locations that are specified for the given {@link SpringApplicationContext} annotation. An array with
* 1 empty string should be considered to be empty and null should be returned.
*
* @param annotation The annotation, not null
* @return The locations, null if no values were specified
*/
@Override
protected List<String> getAnnotationValues(SpringApplicationContext annotation) {
String[] locations = annotation.value();
return asList(locations);
}